class OpenIDConnectClientGoogle in OpenID Connect / OAuth client 7
Implements OpenID Connect Client plugin for Google.
Hierarchy
- class \OpenIDConnectClientBase implements OpenIDConnectClientInterface
- class \OpenIDConnectClientGoogle
Expanded class hierarchy of OpenIDConnectClientGoogle
1 string reference to 'OpenIDConnectClientGoogle'
- google.inc in plugins/
openid_connect_client/ google/ google.inc
File
- plugins/
openid_connect_client/ google/ OpenIDConnectClientGoogle.class.php, line 11 - OpenID Connect client for Google.
View source
class OpenIDConnectClientGoogle extends OpenIDConnectClientBase {
/**
* {@inheritdoc}
*/
public function getEndpoints() {
return array(
'authorization' => 'https://accounts.google.com/o/oauth2/auth',
'token' => 'https://accounts.google.com/o/oauth2/token',
'userinfo' => 'https://openidconnect.googleapis.com/v1/userinfo',
);
}
/**
* {@inheritdoc}
*/
public function retrieveUserInfo($access_token) {
$userinfo = parent::retrieveUserInfo($access_token);
if (!empty($userinfo['picture'])) {
// For some reason Google returns the URI of the profile picture in a
// weird format: "https:" appears twice in the beginning of the URI.
// Using a regular expression matching for fixing it guarantees that
// things won't break if Google changes the way the URI is returned.
preg_match('/https:\\/\\/*.*/', $userinfo['picture'], $matches);
$userinfo['picture'] = $matches[0];
}
return $userinfo;
}
}