aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/google.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php
index b9b1851424..70bad77697 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/google.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/google.php
@@ -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'];
+ }
}