Skip to content

Commit bc6d832

Browse files
authored
Merge pull request #11 from kip260384/patch-1
social provider VK api fix
2 parents 9dce8e3 + d051f4c commit bc6d832

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/PHPixie/Social/Providers/VK/Provider.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,16 @@ protected function normalizeLoginData($loginData, $tokenData)
5252

5353
public function api($token, $method, $endpoint, $query = array(), $data = null)
5454
{
55-
$query['version'] = $this->configData->get('apiVersion', '5.52');
55+
$query['v'] = $this->configData->get('apiVersion', '5.52');
5656
$accessToken = $token->accessToken();
5757
return $this->apiCall($accessToken, $method, $endpoint, $query, $data);
5858
}
5959

6060
public function apiCall($accessToken, $method, $endpoint, $query = array(), $data = null)
6161
{
62+
if (!isset($query['v'])) {
63+
$query['v'] = $this->configData->get('apiVersion', '5.52');
64+
}
6265
$response = parent::apiCall($accessToken, $method, $endpoint, $query, $data);
6366

6467
if(isset($response->error)) {
@@ -71,13 +74,15 @@ public function apiCall($accessToken, $method, $endpoint, $query = array(), $dat
7174

7275
protected function getUserId($loginData)
7376
{
74-
return $loginData->uid;
77+
$id = isset($loginData->id) ? $loginData->id : $loginData->uid;
78+
79+
return $id;
7580
}
7681

7782
protected function buildToken($tokenData, $loginData)
7883
{
7984
return $this->token(
80-
$loginData->uid,
85+
$this->getUserId($loginData),
8186
$tokenData->access_token,
8287
$tokenData->expires_in
8388
);

0 commit comments

Comments
 (0)