Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix authorization process #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
build
composer.lock
docs
vendor
vendor
.idea
16 changes: 9 additions & 7 deletions src/Vkontakte.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Vkontakte extends AbstractProvider
{
protected $baseOAuthUri = 'https://oauth.vk.com';
protected $baseUri = 'https://api.vk.com/method';
protected $version = '5.52';
protected $version = '5.131';
protected $language = null;

/**
Expand Down Expand Up @@ -139,9 +139,8 @@ public function getResourceOwnerDetailsUrl(AccessToken $token)
'lang' => $this->language
];
$query = $this->buildQueryString($params);
$url = "$this->baseUri/users.get?$query";

return $url;
return "$this->baseUri/users.get?$query";
}
protected function getDefaultScopes()
{
Expand Down Expand Up @@ -183,14 +182,12 @@ protected function createResourceOwner(array $response, AccessToken $token)
if (!empty($additional['email'])) {
$response['email'] = $additional['email'];
}
if (!empty($response['uid']) && 4 === floor($this->version)) {
$response['id'] = $response['uid'];
}

if (!empty($additional['user_id'])) {
$response['id'] = $additional['user_id'];
}

return new User($response, $response['id']);
return new User($response);
}

/**
Expand Down Expand Up @@ -261,4 +258,9 @@ public function friendsGet($userId, AccessToken $token = null, array $params = [

return array_map($array2friend, $friends);
}

protected function getAuthorizationParameters(array $options)
{
return array_merge(parent::getAuthorizationParameters($options), ['v' => $this->version]);
}
}