Dmitry Yu Okunev

Initial commit

[submodule "3rdparty/oauth_2.0_client_php"]
path = 3rdparty/oauth_2.0_client_php
url =
... ...
Subproject commit 7afa93f85446c6ff8595143f683fe24c44904231
... ...
OAuth2 auth client lib for NRNU MEPhI
Copyright (C) 2014, Dmitry Y Okunev <>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* D Y Okunev <>: Sorry for this code. As always, no time to do something good :(
define("OAUTH2_LIB_DIR", __DIR__ . "/3rdparty/oauth_2.0_client_php");
require_once OAUTH2_LIB_DIR . "/OAuth2/Exception.php";
class OAuth2_MEPhI {
private $client = NULL;
private $configuration = NULL;
private $storage = NULL;
private $service = NULL;
private $scope = NULL;
function __construct($client_id, $client_secret, $backurl) {
require_once OAUTH2_LIB_DIR . "/OAuth2/Client.php";
$this->client = new OAuth2\Client(
require_once OAUTH2_LIB_DIR . "/OAuth2/Service/Configuration.php";
$this->configuration = new OAuth2\Service\Configuration(
require_once OAUTH2_LIB_DIR . "/OAuth2/DataStore.php";
require_once OAUTH2_LIB_DIR . "/OAuth2/DataStore/Session.php";
$this->storage = new OAuth2\DataStore\Session();
require_once OAUTH2_LIB_DIR . "/OAuth2/Service.php";
$this->service = new OAuth2\Service($this->client, $this->configuration, $this->storage, $this->scope);
function get_token() {
require_once OAUTH2_LIB_DIR . "/OAuth2/Token.php";
require_once OAUTH2_LIB_DIR . "/OAuth2/HttpClient.php";
return json_decode($this->service->callApiEndpoint(''));
... ...