2 Commits
v1.1 ... 1.2

Author SHA1 Message Date
Kasper Rynning-Tønnesen
b570a9e332 Updated some minor settings 2016-07-19 16:43:26 +02:00
Kasper Rynning-Tønnesen
5865b0799e stability 2016-07-19 16:09:21 +02:00
2 changed files with 8 additions and 5 deletions

@@ -35,9 +35,13 @@ class OAuth2 {
$this->response_type = isset($params["response_type"]) ? $params["response_type"] : "code"; $this->response_type = isset($params["response_type"]) ? $params["response_type"] : "code";
} }
public function get_access_token( public function get_access_token($state = false, $code = false) {
$state = mysql_real_escape_string($_GET['state']), if(!$state) {
$code = mysql_real_escape_string($_GET['code'])) { $state = htmlspecialchars($_GET['state']);
}
if(!$code) {
$state = htmlspecialchars($_GET['code']);
}
if($this->session && $state) { if($this->session && $state) {
if($_SESSION['state'] != $state) { if($_SESSION['state'] != $state) {
die('States does not match'); die('States does not match');
@@ -68,7 +72,7 @@ class OAuth2 {
} }
public function get_identity($access_token, $identity_url) { public function get_identity($access_token, $identity_url) {
if(!$access_token || !$identity_url) throw new Exception("Missing either \$access_token or \$identity_url in get_identity function."); if(!$access_token || !$identity_url) throw new \Exception("Missing either \$access_token or \$identity_url in get_identity function.");
$params = array( $params = array(
'access_token' => $access_token, 'access_token' => $access_token,
); );

@@ -4,7 +4,6 @@
"license": "MIT", "license": "MIT",
"keywords": ["authentication"], "keywords": ["authentication"],
"homepage": "https://github.com/kasperrt/oauth2-client", "homepage": "https://github.com/kasperrt/oauth2-client",
"minimum-stability": "dev",
"authors": [ "authors": [
{ {
"name": "Kasper Rynning-Tønnesen", "name": "Kasper Rynning-Tønnesen",