From b570a9e3329463f763bc1dec6c99c5738dd005c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 19 Jul 2016 16:43:26 +0200 Subject: [PATCH] Updated some minor settings --- OAuth2Client.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OAuth2Client.php b/OAuth2Client.php index f33e1c6..79a18e6 100644 --- a/OAuth2Client.php +++ b/OAuth2Client.php @@ -35,9 +35,13 @@ class OAuth2 { $this->response_type = isset($params["response_type"]) ? $params["response_type"] : "code"; } - public function get_access_token( - $state = mysql_real_escape_string($_GET['state']), - $code = mysql_real_escape_string($_GET['code'])) { + public function get_access_token($state = false, $code = false) { + if(!$state) { + $state = htmlspecialchars($_GET['state']); + } + if(!$code) { + $state = htmlspecialchars($_GET['code']); + } if($this->session && $state) { if($_SESSION['state'] != $state) { die('States does not match'); @@ -68,7 +72,7 @@ class OAuth2 { } 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( 'access_token' => $access_token, );