12 require_once dirname(dirname(__FILE__)) .
'/EOAuth2Service.php';
20 protected $name =
'vkontakte';
21 protected $title =
'VK.com';
22 protected $type =
'OAuth';
23 protected $jsArguments = array(
'popup' => array(
'width' => 585,
'height' => 350));
25 protected $client_id =
'';
26 protected $client_secret =
'';
27 protected $scope =
'';
28 protected $providerOptions = array(
29 'authorize' =>
'http://api.vkontakte.ru/oauth/authorize',
30 'access_token' =>
'https://api.vkontakte.ru/oauth/access_token',
33 protected $uid = null;
36 $info = (array)$this->
makeSignedRequest(
'https://api.vkontakte.ru/method/getProfiles', array(
44 $info = $info[
'response'][0];
46 $this->attributes[
'id'] = $info->uid;
47 $this->attributes[
'name'] = $info->first_name.
' '.$info->last_name;
48 $this->attributes[
'url'] =
'http://vkontakte.ru/id'.$info->uid;
75 if (isset($_GET[
'js']))
76 $url .=
'&display=popup';
85 $this->
setState(
'auth_token', $token->access_token);
86 $this->
setState(
'uid', $token->user_id);
87 $this->
setState(
'expires', time() + $token->expires_in - 60);
88 $this->uid = $token->user_id;
89 $this->access_token = $token->access_token;
97 if ($this->
hasState(
'uid') && parent::restoreAccessToken()) {
113 if (isset($json->error)) {
115 'code' => $json->error->error_code,
116 'message' => $json->error->error_msg,