Commit db8593e0 authored by zolij's avatar zolij
parent bc7cb6ec
......@@ -10,7 +10,7 @@ class AuthSCHClient {
private $tokens;
public function __construct($tokens = null) {
$this->tokens = new stdClass();
$this->tokens = new \stdClass();
if($tokens === null) {
if(session_id() == '') {
......@@ -73,10 +73,12 @@ class AuthSCHClient {
$res = json_decode($ch);
// check api access & redirect to auth.sch.bme.hu for authorization
if ($res != null && isset($res->success) && $res->success == true)
if ($res != null && isset($res->success) && $res->success == true) {
header("Location: " . self::$host . "site/login?response_type=code&client_id=". self::$username ."&state=" . sha1($_SERVER['REMOTE_ADDR'] . $_SERVER['HTTP_USER_AGENT']) . "&scope=" . self::$scope);
else
die();
} else {
throw new Exception("error during api check");
}
} else {
$data = array(
'grant_type'=>'authorization_code',
......@@ -98,4 +100,4 @@ class AuthSCHClient {
return json_decode(file_get_contents(self::$host . 'api/profile/?access_token=' . $this->tokens->access_token));
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment