You are here

public function JanrainCaptureApi::getUserProfile in Janrain Registration 8

Returns the user's profile data.

Return value

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

Throws

\InvalidArgumentException

\GuzzleHttp\Exception\GuzzleException

\Drupal\janrain_capture\Exception\JsonParseError

\Drupal\janrain_capture\Exception\JanrainApiCallError

\Drupal\janrain_capture\Exception\JanrainUnauthorizedError

Overrides JanrainCaptureApiInterface::getUserProfile

File

src/JanrainCaptureApi.php, line 218

Class

JanrainCaptureApi
The integration between Janrain and Drupal.

Namespace

Drupal\janrain_capture

Code

public function getUserProfile() : JanrainUserProfile {
  try {

    // Use an existing access token.
    return $this
      ->getEntity($this
      ->getAccessToken());
  } catch (JanrainUnauthorizedError $e) {

    // Try to load an entity once again using prolonged access token.
    return $this
      ->getEntity($this
      ->getAccessToken(TRUE));
  }
}