public function OpenIDConnectGoogleClient::retrieveUserInfo in OpenID Connect / OAuth client 8
Same name and namespace in other branches
- 2.x src/Plugin/OpenIDConnectClient/OpenIDConnectGoogleClient.php \Drupal\openid_connect\Plugin\OpenIDConnectClient\OpenIDConnectGoogleClient::retrieveUserInfo()
Retrieves user info: additional user profile data.
Parameters
string $access_token: Access token.
Return value
array|bool User profile information array, or FALSE if retrieval failed.
Overrides OpenIDConnectClientBase::retrieveUserInfo
File
- src/Plugin/ OpenIDConnectClient/ OpenIDConnectGoogleClient.php, line 49 
Class
- OpenIDConnectGoogleClient
- Google OpenID Connect client.
Namespace
Drupal\openid_connect\Plugin\OpenIDConnectClientCode
public function retrieveUserInfo($access_token) {
  $userinfo = parent::retrieveUserInfo($access_token);
  if ($userinfo) {
    // 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;
}