1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-25 04:23:38 +01:00

[feature/oauth] Google support

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-18 16:04:44 -04:00
parent 772a977afc
commit a673eb8cbc

View File

@ -60,4 +60,25 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
'secret' => $this->config['auth_oauth_google_secret'],
);
}
/**
* {@inheritdoc}
*/
public function perform_auth_login()
{
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
{
// TODO: make exception class and use language constant
throw new Exception('Invalid service provider type');
}
// This was a callback request from bitly, get the token
$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 );
// Return the unique identifier returned from bitly
return $result['id'];
}
}