mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-12 19:54:12 +02:00
[feature/oauth] Changes due to code review
PHPBB3-11673
This commit is contained in:
@@ -71,10 +71,10 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_
|
||||
}
|
||||
|
||||
// This was a callback request from bitly, get the token
|
||||
$this->service_provider->requestAccessToken( $this->request->variable('code', '') );
|
||||
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('user/info'), true );
|
||||
$result = json_decode($this->service_provider->request('user/info'), true);
|
||||
|
||||
// Return the unique identifier returned from bitly
|
||||
return $result['data']['login'];
|
||||
@@ -91,7 +91,7 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_
|
||||
}
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('user/info'), true );
|
||||
$result = json_decode($this->service_provider->request('user/info'), true);
|
||||
|
||||
// Return the unique identifier returned from bitly
|
||||
return $result['data']['login'];
|
||||
|
@@ -66,15 +66,14 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
|
||||
{
|
||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
||||
{
|
||||
// TODO: make exception class and use language constant
|
||||
throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||
}
|
||||
|
||||
// This was a callback request, get the token
|
||||
$this->service_provider->requestAccessToken( $this->request->variable('code', '') );
|
||||
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('/me'), true );
|
||||
$result = json_decode($this->service_provider->request('/me'), true);
|
||||
|
||||
// Return the unique identifier
|
||||
return $result['id'];
|
||||
@@ -87,12 +86,11 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
|
||||
{
|
||||
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
|
||||
{
|
||||
// TODO: make exception class and use language constant
|
||||
throw new Exception('Invalid service provider type');
|
||||
throw new Exception('AUTH_PROVIDER_OAUTH_ERROR_INVALID_SERVICE_TYPE');
|
||||
}
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('/me'), true );
|
||||
$result = json_decode($this->service_provider->request('/me'), true);
|
||||
|
||||
// Return the unique identifier
|
||||
return $result['id'];
|
||||
|
@@ -81,10 +81,10 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
|
||||
}
|
||||
|
||||
// This was a callback request, get the token
|
||||
$this->service_provider->requestAccessToken( $this->request->variable('code', '') );
|
||||
$this->service_provider->requestAccessToken($this->request->variable('code', ''));
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true );
|
||||
$result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
|
||||
|
||||
// Return the unique identifier
|
||||
return $result['id'];
|
||||
@@ -101,7 +101,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
|
||||
}
|
||||
|
||||
// Send a request with it
|
||||
$result = json_decode( $this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true );
|
||||
$result = json_decode($this->service_provider->request('https://www.googleapis.com/oauth2/v1/userinfo'), true);
|
||||
|
||||
// Return the unique identifier
|
||||
return $result['id'];
|
||||
|
Reference in New Issue
Block a user