Skip to content

Instantly share code, notes, and snippets.

@niraj-shah
Created February 13, 2013 11:31
Show Gist options
  • Save niraj-shah/4943987 to your computer and use it in GitHub Desktop.
Save niraj-shah/4943987 to your computer and use it in GitHub Desktop.
Facebook Base SDK for PHP 5.3.x
<?php
protected function getCode() {
if (isset($_REQUEST['code'])) {
if ($this->state !== null &&
isset($_REQUEST['state']) &&
$this->state === $_REQUEST['state']) {
// CSRF state has done its job, so clear it
$this->state = null;
$this->clearPersistentData('state');
return $_REQUEST['code'];
} else {
self::errorLog('CSRF state token does not match one provided.');
return false;
}
}
return false;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment