1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +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 = []; protected $user = [];
/**
* @var array
*/
protected $scopes = ['openid' ,'email'];
/** /**
* @var string * @var string
*/ */
@ -36,13 +41,14 @@ class Vk extends OAuth
*/ */
public function getLoginURL(): string public function getLoginURL(): string
{ {
return 'https://oauth.vk.com/authorize?' . return 'https://oauth.vk.com/authorize?' . http_build_query([
'client_id='.urlencode($this->appID). 'client_id' => $this->appID,
'&redirect_uri='.urlencode($this->callback). 'redirect_uri' => $this->callback,
'&response_type=code'. 'response_type' => 'code',
'&state='.urlencode(json_encode($this->state)). 'state' => json_encode($this->state),
'&v='.urlencode($this->version). 'v' => $this->version,
'&scope=openid+email'; 'scope' => implode(' ', $this->getScopes())
]);
} }
/** /**
@ -57,10 +63,12 @@ class Vk extends OAuth
'POST', 'POST',
'https://oauth.vk.com/access_token?', 'https://oauth.vk.com/access_token?',
$headers, $headers,
'code=' . urlencode($code) . http_build_query([
'&client_id=' . urlencode($this->appID) . 'code' => $code,
'&client_secret=' . urlencode($this->appSecret). 'client_id' => $this->appID,
'&redirect_uri='.urlencode($this->callback) 'client_secret' => $this->appSecret,
'redirect_uri' => $this->callback
])
); );
$accessToken = json_decode($accessToken, true); $accessToken = json_decode($accessToken, true);