1
0
Fork 0
mirror of synced 2024-07-01 20:50:49 +12:00

chpore: vk adapter changes

This commit is contained in:
Christy Jacob 2020-01-19 01:18:59 +05:30
parent efdacd7248
commit a4630b4995

View file

@ -17,6 +17,11 @@ class Vk extends OAuth
*/
protected $user = [];
/**
* @var array
*/
protected $scopes = ['openid' ,'email'];
/**
* @var string
*/
@ -36,13 +41,14 @@ class Vk extends OAuth
*/
public function getLoginURL(): string
{
return 'https://oauth.vk.com/authorize?' .
'client_id='.urlencode($this->appID).
'&redirect_uri='.urlencode($this->callback).
'&response_type=code'.
'&state='.urlencode(json_encode($this->state)).
'&v='.urlencode($this->version).
'&scope=openid+email';
return 'https://oauth.vk.com/authorize?' . http_build_query([
'client_id' => $this->appID,
'redirect_uri' => $this->callback,
'response_type' => 'code',
'state' => json_encode($this->state),
'v' => $this->version,
'scope' => implode(' ', $this->getScopes())
]);
}
/**
@ -57,10 +63,12 @@ class Vk extends OAuth
'POST',
'https://oauth.vk.com/access_token?',
$headers,
'code=' . urlencode($code) .
'&client_id=' . urlencode($this->appID) .
'&client_secret=' . urlencode($this->appSecret).
'&redirect_uri='.urlencode($this->callback)
http_build_query([
'code' => $code,
'client_id' => $this->appID,
'client_secret' => $this->appSecret,
'redirect_uri' => $this->callback
])
);
$accessToken = json_decode($accessToken, true);