You are here

public function OpenIDConnectClientBase::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 OpenIDConnectClientInterface::retrieveUserInfo

1 call to OpenIDConnectClientBase::retrieveUserInfo()
OpenIDConnectClientGoogle::retrieveUserInfo in plugins/openid_connect_client/google/OpenIDConnectClientGoogle.class.php
Retrieves user info: additional user profile data.
1 method overrides OpenIDConnectClientBase::retrieveUserInfo()
OpenIDConnectClientGoogle::retrieveUserInfo in plugins/openid_connect_client/google/OpenIDConnectClientGoogle.class.php
Retrieves user info: additional user profile data.

File

includes/OpenIDConnectClientBase.class.php, line 186
Base class for OpenID Connect clients.

Class

OpenIDConnectClientBase
Base class for OpenID Connect clients.

Code

public function retrieveUserInfo($access_token) {
  $request_options = array(
    'headers' => array(
      'Authorization' => 'Bearer ' . $access_token,
    ),
  );
  $endpoints = $this
    ->getEndpoints();
  $response = drupal_http_request($endpoints['userinfo'], $request_options);
  if (!isset($response->error) && $response->code == 200) {
    return drupal_json_decode($response->data);
  }
  openid_connect_log_request_error(__FUNCTION__, $this->name, $response);
  return array();
}