Dmitry Yu Okunev

Few fixes

... ... @@ -26,7 +26,10 @@
define("OAUTH2_LIB_DIR", __DIR__ . "/3rdparty/oauth_2.0_client_php");
require_once OAUTH2_LIB_DIR . "/OAuth2/Exception.php";
define('OAUTH2_URL', 'https://oauth2.ut.mephi.ru/');
class OAuth2_MEPhI {
private $client_id = NULL;
private $client = NULL;
private $configuration = NULL;
private $storage = NULL;
... ... @@ -35,6 +38,8 @@ class OAuth2_MEPhI {
function __construct($client_id, $client_secret, $backurl) {
require_once OAUTH2_LIB_DIR . "/OAuth2/Client.php";
$this->client_id = $client_id;
$this->client = new OAuth2\Client(
$client_id,
$client_secret,
... ... @@ -43,8 +48,8 @@ class OAuth2_MEPhI {
require_once OAUTH2_LIB_DIR . "/OAuth2/Service/Configuration.php";
$this->configuration = new OAuth2\Service\Configuration(
'http://oauth2.ut.mephi.ru/authorize.php',
'http://oauth2.ut.mephi.ru/token.php'
OAUTH2_URL.'authorize.php',
OAUTH2_URL.'token.php'
);
$this->configuration->setAuthorizationMethod(OAuth2\Service\Configuration::AUTHORIZATION_METHOD_ALTERNATIVE);
... ... @@ -61,7 +66,12 @@ class OAuth2_MEPhI {
require_once OAUTH2_LIB_DIR . "/OAuth2/HttpClient.php";
$this->service->getAccessToken();
return json_decode($this->service->callApiEndpoint('http://oauth2.ut.mephi.ru/token_data.php'));
return json_decode($this->service->callApiEndpoint(OAUTH2_URL.'token_data.php'));
}
function check_if_authed() {
header('Location: '.OAUTH2_URL.'authorize.php?cmd=check&client_id='.$this->client_id.'&response_type=code&state=authentication');
return NULL;
}
}
... ...