diff options
-rw-r--r-- | phpBB/config/auth_providers.yml | 1 | ||||
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/service/bitly.php | 31 |
2 files changed, 31 insertions, 1 deletions
diff --git a/phpBB/config/auth_providers.yml b/phpBB/config/auth_providers.yml index 0d2075bc87..74f674a1f9 100644 --- a/phpBB/config/auth_providers.yml +++ b/phpBB/config/auth_providers.yml @@ -62,6 +62,7 @@ services: class: phpbb_auth_provider_oauth_service_bitly arguments: - @config + - @request tags: - { name: auth.provider.oauth.service } auth.provider.oauth.service.box: diff --git a/phpBB/phpbb/auth/provider/oauth/service/bitly.php b/phpBB/phpbb/auth/provider/oauth/service/bitly.php index 6b6e08c19a..cbfad3d852 100644 --- a/phpBB/phpbb/auth/provider/oauth/service/bitly.php +++ b/phpBB/phpbb/auth/provider/oauth/service/bitly.php @@ -30,13 +30,22 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ protected $config; /** + * phpBB request + * + * @var phpbb_request + */ + protected $request; + + /** * Constructor * * @param phpbb_config $config + * @param phpbb_request $request */ - public function __construct(phpbb_config $config) + public function __construct(phpbb_config $config, phpbb_request $request) { $this->config = $config; + $this->request = $request; } /** @@ -49,4 +58,24 @@ class phpbb_auth_provider_oauth_service_bitly extends phpbb_auth_provider_oauth_ 'secret' => $this->config['auth_oauth_bitly_secret'], ); } + + /** + * {@inheritdoc} + */ + public function perform_auth_login() + { + if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Bitly)) + { + // 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('user/info'), true ); + + // Get the user id + } } |