Added missing "League" in namespaces
parent
27ebf092ba
commit
639043b955
|
@ -17,12 +17,12 @@ class Facebook extends IdentityProvider
|
|||
return 'https://graph.facebook.com/oauth/access_token';
|
||||
}
|
||||
|
||||
public function urlUserDetails(\OAuth2\Client\Token\AccessToken $token)
|
||||
public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
return 'https://graph.facebook.com/me?access_token='.$token;
|
||||
}
|
||||
|
||||
public function userDetails($response, \OAuth2\Client\Token\AccessToken $token)
|
||||
public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
$imageHeaders = get_headers('https://graph.facebook.com/me/picture?type=normal&access_token='.$token->accessToken, 1);
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ class Github extends IdentityProvider
|
|||
return 'https://github.com/login/oauth/access_token';
|
||||
}
|
||||
|
||||
public function urlUserDetails(\OAuth2\Client\Token\AccessToken $token)
|
||||
public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
return 'https://api.github.com/user?access_token='.$token;
|
||||
}
|
||||
|
||||
public function userDetails($response, \OAuth2\Client\Token\AccessToken $token)
|
||||
public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
$user = new User;
|
||||
$user->uid = $response->id;
|
||||
|
|
|
@ -21,12 +21,12 @@ class Google extends IdentityProvider
|
|||
return 'https://accounts.google.com/o/oauth2/token';
|
||||
}
|
||||
|
||||
public function urlUserDetails(\OAuth2\Client\Token\AccessToken $token)
|
||||
public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
return 'https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token='.$token;
|
||||
}
|
||||
|
||||
public function userDetails($response, \OAuth2\Client\Token\AccessToken $token)
|
||||
public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token)
|
||||
{
|
||||
$response = (array) $response;
|
||||
$user = new User;
|
||||
|
|
|
@ -40,9 +40,9 @@ abstract class IdentityProvider {
|
|||
|
||||
abstract public function urlAccessToken();
|
||||
|
||||
abstract public function urlUserDetails(\OAuth2\Client\Token\AccessToken $token);
|
||||
abstract public function urlUserDetails(\League\OAuth2\Client\Token\AccessToken $token);
|
||||
|
||||
abstract public function userDetails($response, \OAuth2\Client\Token\AccessToken $token);
|
||||
abstract public function userDetails($response, \League\OAuth2\Client\Token\AccessToken $token);
|
||||
|
||||
public function authorize($options = array())
|
||||
{
|
||||
|
@ -65,13 +65,13 @@ abstract class IdentityProvider {
|
|||
public function getAccessToken($grant = 'authorization_code', $params = array())
|
||||
{
|
||||
if (is_string($grant)) {
|
||||
$grant = 'OAuth2\\Client\\Grant\\'.ucfirst(str_replace('_', '', $grant));
|
||||
$grant = 'League\\OAuth2\\Client\\Grant\\'.ucfirst(str_replace('_', '', $grant));
|
||||
if ( ! class_exists($grant)) {
|
||||
throw new \InvalidArgumentException('Unknown grant "'.$grant.'"');
|
||||
}
|
||||
$grant = new $grant;
|
||||
} elseif ( ! $grant instanceof Grant\GrantInterface) {
|
||||
throw new \InvalidArgumentException($grant.' is not an instance of \OAuth2\Client\Grant\GrantInterface');
|
||||
throw new \InvalidArgumentException($grant.' is not an instance of League\OAuth2\Client\Grant\GrantInterface');
|
||||
}
|
||||
|
||||
$defaultParams = array(
|
||||
|
|
Loading…
Reference in New Issue