You are here

function JanrainCaptureApi::refreshAccessToken in Janrain Registration 7

Same name and namespace in other branches
  1. 6 janrain_capture.api.inc \JanrainCaptureApi::refreshAccessToken()
  2. 7.4 includes/janrain_capture.api.inc \JanrainCaptureApi::refreshAccessToken()
  3. 7.2 includes/janrain_capture.api.inc \JanrainCaptureApi::refreshAccessToken()
  4. 7.3 includes/janrain_capture.api.inc \JanrainCaptureApi::refreshAccessToken()

Retrieves a new access_token/refresh_token set

Return value

boolean Boolean success or failure

1 call to JanrainCaptureApi::refreshAccessToken()
JanrainCaptureApi::loadUserEntity in ./janrain_capture.api.inc
Retrives the user entity from Capture

File

./janrain_capture.api.inc, line 196
An API Client for making calls to the Janrain Capture web service.

Class

JanrainCaptureApi
@file An API Client for making calls to the Janrain Capture web service.

Code

function refreshAccessToken() {
  if (empty($_SESSION['janrain_capture_refresh_token'])) {
    return FALSE;
  }
  $refresh_token = $this
    ->refreshTokenReveal($_SESSION['janrain_capture_refresh_token']);
  $command = "oauth/token";
  $arg_array = array(
    'refresh_token' => $refresh_token,
    'grant_type' => 'refresh_token',
  );
  $json_data = $this
    ->call($command, $arg_array);
  if ($json_data) {
    $this
      ->updateCaptureSession($json_data);
    return TRUE;
  }
  return FALSE;
}