aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/auth/provider/oauth/service
diff options
context:
space:
mode:
authorJoseph Warner <hardolaf@hardolaf.com>2013-07-29 16:03:54 -0400
committerJoseph Warner <hardolaf@hardolaf.com>2013-07-29 16:04:08 -0400
commit3d55e5faa91f0161bc020720a81b50171b30f49d (patch)
treecb289863ebaccc21ea4aeb39902549a440de09dc /phpBB/phpbb/auth/provider/oauth/service
parent641433920e43478a021743557f69382292f60f68 (diff)
downloadforums-3d55e5faa91f0161bc020720a81b50171b30f49d.tar
forums-3d55e5faa91f0161bc020720a81b50171b30f49d.tar.gz
forums-3d55e5faa91f0161bc020720a81b50171b30f49d.tar.bz2
forums-3d55e5faa91f0161bc020720a81b50171b30f49d.tar.xz
forums-3d55e5faa91f0161bc020720a81b50171b30f49d.zip
[feature/oauth] Works in all tests now
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth/provider/oauth/service')
-rw-r--r--phpBB/phpbb/auth/provider/oauth/service/google.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/service/google.php b/phpBB/phpbb/auth/provider/oauth/service/google.php
index 3e5735b97c..c5de1e01d2 100644
--- a/phpBB/phpbb/auth/provider/oauth/service/google.php
+++ b/phpBB/phpbb/auth/provider/oauth/service/google.php
@@ -81,7 +81,7 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
throw new Exception('Invalid service provider type');
}
- // This was a callback request from bitly, get the token
+ // This was a callback request, get the token
$this->service_provider->requestAccessToken( $this->request->variable('code', '') );
// Send a request with it
@@ -90,4 +90,22 @@ class phpbb_auth_provider_oauth_service_google extends phpbb_auth_provider_oauth
// Return the unique identifier returned from bitly
return $result['id'];
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function perform_auth_link()
+ {
+ if (!($this->service_provider instanceof \OAuth\OAuth2\Service\Google))
+ {
+ // TODO: make exception class and use language constant
+ throw new Exception('Invalid service provider type');
+ }
+
+ // 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'];
+ }
}