Merge pull request #225 from shadowhand/clean-up-providers
Clean out custom provider code from AccessTokenoauth1test
commit
ee69b69923
|
@ -7,8 +7,7 @@ use League\OAuth2\Client\Token\AccessToken;
|
||||||
|
|
||||||
class Vkontakte extends AbstractProvider
|
class Vkontakte extends AbstractProvider
|
||||||
{
|
{
|
||||||
public $scopes = [];
|
public $uidKey = 'user_id';
|
||||||
public $responseType = 'json';
|
|
||||||
|
|
||||||
public function urlAuthorize()
|
public function urlAuthorize()
|
||||||
{
|
{
|
||||||
|
|
|
@ -43,17 +43,13 @@ class AccessToken
|
||||||
|
|
||||||
$this->accessToken = $options['access_token'];
|
$this->accessToken = $options['access_token'];
|
||||||
|
|
||||||
// Some providers (not many) give the uid here, so lets take it
|
if (!empty($options['uid'])) {
|
||||||
isset($options['uid']) and $this->uid = $options['uid'];
|
$this->uid = $options['uid'];
|
||||||
|
}
|
||||||
|
|
||||||
// Vkontakte uses user_id instead of uid
|
if (!empty($options['refresh_token'])) {
|
||||||
isset($options['user_id']) and $this->uid = $options['user_id'];
|
$this->refreshToken = $options['refresh_token'];
|
||||||
|
}
|
||||||
// Mailru uses x_mailru_vid instead of uid
|
|
||||||
isset($options['x_mailru_vid']) and $this->uid = $options['x_mailru_vid'];
|
|
||||||
|
|
||||||
//Battle.net uses accountId instead of uid
|
|
||||||
isset($options['accountId']) and $this->uid = $options['accountId'];
|
|
||||||
|
|
||||||
// We need to know when the token expires. Show preference to
|
// We need to know when the token expires. Show preference to
|
||||||
// 'expires_in' since it is defined in RFC6749 Section 5.1.
|
// 'expires_in' since it is defined in RFC6749 Section 5.1.
|
||||||
|
@ -67,9 +63,6 @@ class AccessToken
|
||||||
$expiresInFuture = $expires > time();
|
$expiresInFuture = $expires > time();
|
||||||
$this->expires = $expiresInFuture ? $expires : time() + ((int) $expires);
|
$this->expires = $expiresInFuture ? $expires : time() + ((int) $expires);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Grab a refresh token so we can update access tokens when they expires
|
|
||||||
isset($options['refresh_token']) and $this->refreshToken = $options['refresh_token'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue