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 = [];
|
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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue