[feature/oauth] Facebook support

PHPBB3-11673
This commit is contained in:
Joseph Warner 2013-07-18 16:03:29 -04:00
parent 2eb47d00e0
commit 772a977afc

View file

@ -49,4 +49,25 @@ class phpbb_auth_provider_oauth_service_facebook extends phpbb_auth_provider_oau
'secret' => $this->config['auth_oauth_facebook_secret'], 'secret' => $this->config['auth_oauth_facebook_secret'],
); );
} }
/**
* {@inheritdoc}
*/
public function perform_auth_login()
{
if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Facebook))
{
// 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('/me'), true );
// Return the unique identifier returned from bitly
return $result['id'];
}
} }