diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-14 11:48:02 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-14 14:22:43 -0400 |
commit | 4b1390ca31949d9de0df3b9038144e882c75a5e7 (patch) | |
tree | 0e694e7062fe26f53830e821f5d91d6de2d3f9b3 | |
parent | e600596602d1fed7eedda02c848db9012fda43fa (diff) | |
download | forums-4b1390ca31949d9de0df3b9038144e882c75a5e7.tar forums-4b1390ca31949d9de0df3b9038144e882c75a5e7.tar.gz forums-4b1390ca31949d9de0df3b9038144e882c75a5e7.tar.bz2 forums-4b1390ca31949d9de0df3b9038144e882c75a5e7.tar.xz forums-4b1390ca31949d9de0df3b9038144e882c75a5e7.zip |
[feature/oauth] Pathing information for some services
PHPBB3-11673
-rw-r--r-- | phpBB/includes/auth/provider/oauth.php | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/phpBB/includes/auth/provider/oauth.php b/phpBB/includes/auth/provider/oauth.php index 79a5988526..aeca2a4869 100644 --- a/phpBB/includes/auth/provider/oauth.php +++ b/phpBB/includes/auth/provider/oauth.php @@ -133,8 +133,13 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base $service->requestAccessToken( $_GET['code'] ); // Send a request with it - $result = json_decode( $service->request('user/info'), true ); + $path = $this->get_path($service_name); + if ($path) + { + $result = json_decode( $service->request($path), true ); + } + // Perform authentication } else { $url = $service->getAuthorizationUri(); // TODO: modify $url for the appropriate return points @@ -250,14 +255,47 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base * Returns the path desired of the service * * @param string $service_name - * @return string|UriInterface + * @return string|UriInterface|null A null return means do not + * request additional information. */ protected function get_path($service_name) { switch ($service_name) { + case 'bitly': + case 'tumblr': + $path = 'user/info'; + break; + case 'box': + $path = '/users/me'; + break; + case 'facebook': + $path = '/me'; + break; + case 'FitBit': + $path = 'user/-/profile.json'; + break; + case 'foursquare': + case 'instagram': + $path = 'users/self'; + break; + case 'GitHub': + $path = 'user/emails'; + break; + case 'google': + $path = 'https://www.googleapis.com/oauth2/v1/userinfo'; + break; + case 'linkedin': + $path = '/people/~?format=json'; + break; + case 'soundCloud': + $path = 'me.json'; + break; + case 'twitter': + $path = 'account/verify_credentials.json'; + break; default: - $path = ''; + $path = null; break; } |