You are here

protected function JanrainCaptureApi::getEntity in Janrain Registration 8

Returns the user's profile data.

@link https://docs.janrain.com/api/registration/entity/#entity @link https://docs.janrain.com/api/registration/error-codes

Parameters

\Drupal\janrain_capture\Authentication\AccessToken $access_token: The access token.

Return value

\Drupal\janrain_capture\User\JanrainUserProfile The user's profile data.

Throws

\GuzzleHttp\Exception\TransferException

\Drupal\janrain_capture\Exception\JsonParseError

\Drupal\janrain_capture\Exception\JanrainApiCallError

\Drupal\janrain_capture\Exception\JanrainUnauthorizedError

2 calls to JanrainCaptureApi::getEntity()
JanrainCaptureApi::authenticate in src/JanrainCaptureApi.php
Returns requested access token and set it to the current session.
JanrainCaptureApi::getUserProfile in src/JanrainCaptureApi.php
Returns the user's profile data.

File

src/JanrainCaptureApi.php, line 312

Class

JanrainCaptureApi
The integration between Janrain and Drupal.

Namespace

Drupal\janrain_capture

Code

protected function getEntity(AccessToken $access_token) : JanrainUserProfile {
  $entity = $this
    ->call('entity', [], $access_token
    ->getToken());
  if (isset($entity->code)) {
    throw new JanrainUnauthorizedError($entity->error_description, $entity->code);
  }
  return new JanrainUserProfile($entity->result);
}