aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-18 16:04:44 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-18 16:04:58 -0400
commita673eb8cbc8c464e550a5528f932e07a079f1fac (patch)
tree51eb76ff3f279a1cad133d7b243c8fd9aba623e7 /phpBB/phpbb/auth/provider
parent772a977afcd4919c9d8bfcc8e402f4af4d3aefbf (diff)
downloadforums-a673eb8cbc8c464e550a5528f932e07a079f1fac.tar
forums-a673eb8cbc8c464e550a5528f932e07a079f1fac.tar.gz
forums-a673eb8cbc8c464e550a5528f932e07a079f1fac.tar.bz2
forums-a673eb8cbc8c464e550a5528f932e07a079f1fac.tar.xz
forums-a673eb8cbc8c464e550a5528f932e07a079f1fac.zip
[feature/oauth] Google support
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth/provider')
-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'];
+ }
}