public function OpenIDConnectClientGoogle::retrieveUserInfo in OpenID Connect / OAuth client 7
Retrieves user info: additional user profile data.
Parameters
string $access_token: Access token.
Return value
array User profile information.
Overrides OpenIDConnectClientBase::retrieveUserInfo
File
- plugins/
openid_connect_client/ google/ OpenIDConnectClientGoogle.class.php, line 27 - OpenID Connect client for Google.
Class
- OpenIDConnectClientGoogle
- Implements OpenID Connect Client plugin for Google.
Code
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;
}