12 require_once dirname(dirname(__FILE__)) .
'/EOAuth2Service.php';
20 protected $name =
'moikrug';
21 protected $title =
'Moikrug.ru';
22 protected $type =
'OAuth';
23 protected $jsArguments = array(
'popup' => array(
'width' => 500,
'height' => 450));
25 protected $client_id =
'';
26 protected $client_secret =
'';
27 protected $scope =
'';
28 protected $providerOptions = array(
29 'authorize' =>
'https://oauth.yandex.ru/authorize',
30 'access_token' =>
'https://oauth.yandex.ru/token',
32 protected $fields =
'';
36 $info = (array)$info[0];
37 $this->attributes[
'id'] = $info[
'id'];
38 $this->attributes[
'name'] = $info[
'name'];
39 $this->attributes[
'url'] = $info[
'link'];
41 $this->attributes[
'gender'] = ($info[
'gender'] ==
'male') ?
'M' :
'F';
46 if (isset($_GET[
'js']))
47 $url .=
'&display=popup';
52 return $this->providerOptions[
'access_token'];
57 'grant_type' =>
'authorization_code',
59 'client_id' => $this->client_id,
60 'client_secret' => $this->client_secret,
70 $this->
setState(
'auth_token', $token->access_token);
71 $this->
setState(
'expires', time() + (isset($token->expires_in) ? $token->expires_in : 365*86400) - 60);
72 $this->access_token = $token->access_token;
85 throw new CHttpException(401,
'Unable to complete the authentication because the required data was not received.');
87 $options[
'query'][
'oauth_token'] = $this->access_token;