mirror of
https://github.com/elyby/oauth2-server.git
synced 2024-12-15 17:58:56 +05:30
Fixed namespaces in providers
Signed-off-by: Alex Bilbie <alex@alexbilbie.com>
This commit is contained in:
parent
74338bca6c
commit
52bd18a2b4
@ -1,7 +1,5 @@
|
||||
<?php
|
||||
|
||||
namespace Oauth2\Client\Provider;
|
||||
|
||||
class Blooie extends Oauth2\Client\IDP
|
||||
{
|
||||
public $scope = array('user.profile', 'user.picture');
|
||||
@ -18,7 +16,7 @@ class Blooie extends Oauth2\Client\IDP
|
||||
return 'https://bloo.ie/oauth/access_token';
|
||||
}
|
||||
|
||||
public function getUserInfo(OAuth2\Token\Access $token)
|
||||
public function getUserInfo(Oauth2\Token\Access $token)
|
||||
{
|
||||
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
||||
'access_token' => $token->access_token,
|
||||
@ -26,7 +24,6 @@ class Blooie extends Oauth2\Client\IDP
|
||||
|
||||
$user = json_decode(file_get_contents($url));
|
||||
|
||||
// Create a response from the request
|
||||
return array(
|
||||
'uid' => $user->id,
|
||||
'nickname' => $user->username,
|
||||
|
@ -9,23 +9,21 @@
|
||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||
*/
|
||||
|
||||
namespace Oauth2\Client\Provider;
|
||||
|
||||
class Facebook extends Oauth2\Client\Provider
|
||||
class Facebook extends Oauth2\Client\IDP
|
||||
{
|
||||
protected $scope = array('offline_access', 'email', 'read_stream');
|
||||
|
||||
public function url_authorize()
|
||||
public function urlAuthorize()
|
||||
{
|
||||
return 'https://www.facebook.com/dialog/oauth';
|
||||
}
|
||||
|
||||
public function url_access_token()
|
||||
public function urlAccessToken()
|
||||
{
|
||||
return 'https://graph.facebook.com/oauth/access_token';
|
||||
}
|
||||
|
||||
public function get_user_info(OAuth2_Token_Access $token)
|
||||
public function getUserInfo(Oauth2\Token\Access $token)
|
||||
{
|
||||
$url = 'https://graph.facebook.com/me?'.http_build_query(array(
|
||||
'access_token' => $token->access_token,
|
||||
@ -33,7 +31,6 @@ class Facebook extends Oauth2\Client\Provider
|
||||
|
||||
$user = json_decode(file_get_contents($url));
|
||||
|
||||
// Create a response from the request
|
||||
return array(
|
||||
'uid' => $user->id,
|
||||
'nickname' => isset($user->username) ? $user->username : null,
|
||||
|
@ -9,21 +9,21 @@
|
||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||
*/
|
||||
|
||||
class OAuth2_Provider_Foursquare extends OAuth2_Provider
|
||||
class Foursquare extends Oauth2\Client\IDP
|
||||
{
|
||||
public $method = 'POST';
|
||||
|
||||
public function url_authorize()
|
||||
public function urlAuthorize()
|
||||
{
|
||||
return 'https://foursquare.com/oauth2/authenticate';
|
||||
}
|
||||
|
||||
public function url_access_token()
|
||||
public function urlAccessToken()
|
||||
{
|
||||
return 'https://foursquare.com/oauth2/access_token';
|
||||
}
|
||||
|
||||
public function get_user_info(OAuth2_Token_Access $token)
|
||||
public function getUserInfo(Oauth2\Token\Access $token)
|
||||
{
|
||||
$url = 'https://api.foursquare.com/v2/users/self?'.http_build_query(array(
|
||||
'oauth_token' => $token->access_token,
|
||||
@ -36,7 +36,6 @@ class OAuth2_Provider_Foursquare extends OAuth2_Provider
|
||||
// Create a response from the request
|
||||
return array(
|
||||
'uid' => $user->id,
|
||||
//'nickname' => $user->login,
|
||||
'name' => sprintf('%s %s', $user->firstName, $user->lastName),
|
||||
'email' => $user->contact->email,
|
||||
'image' => $user->photo,
|
||||
|
@ -9,19 +9,19 @@
|
||||
* @license http://philsturgeon.co.uk/code/dbad-license
|
||||
*/
|
||||
|
||||
class OAuth2_Provider_Github extends OAuth2_Provider
|
||||
class OAuth2_Provider_Github extends Oauth2\Client\IDP
|
||||
{
|
||||
public function url_authorize()
|
||||
public function urlAuthorize()
|
||||
{
|
||||
return 'https://github.com/login/oauth/authorize';
|
||||
}
|
||||
|
||||
public function url_access_token()
|
||||
public function urlAccessToken()
|
||||
{
|
||||
return 'https://github.com/login/oauth/access_token';
|
||||
}
|
||||
|
||||
public function get_user_info(OAuth2_Token_Access $token)
|
||||
public function getUserInfo(Oauth\Token\Access $token)
|
||||
{
|
||||
$url = 'https://api.github.com/user?'.http_build_query(array(
|
||||
'access_token' => $token->access_token,
|
||||
@ -29,7 +29,6 @@ class OAuth2_Provider_Github extends OAuth2_Provider
|
||||
|
||||
$user = json_decode(file_get_contents($url));
|
||||
|
||||
// Create a response from the request
|
||||
return array(
|
||||
'uid' => $user->id,
|
||||
'nickname' => $user->login,
|
||||
|
Loading…
Reference in New Issue
Block a user