You are here

function JanrainCaptureApi::refreshAccessToken in Janrain Registration 7.4

Same name and namespace in other branches
  1. 6 janrain_capture.api.inc \JanrainCaptureApi::refreshAccessToken()
  2. 7 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 includes/janrain_capture.api.inc
Retrives the user entity from Capture

File

includes/janrain_capture.api.inc, line 169
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 = $_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;
}