chpore: vk adapter changes
This commit is contained in:
parent
efdacd7248
commit
a4630b4995
1 changed files with 19 additions and 11 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue