You are here

public function JanrainCaptureApi::newAccessToken in Janrain Registration 7

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

Perform the exchange to generate a new Access Token

Parameters

string $auth_code: The authorization token to use for the exchange

string $redirect_uri: The redirect_uri string to match for the exchange

File

./janrain_capture.api.inc, line 173
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

public function newAccessToken($auth_code, $redirect_uri) {
  $command = "oauth/token";
  $arg_array = array(
    'code' => $auth_code,
    'redirect_uri' => $redirect_uri,
    'grant_type' => 'authorization_code',
  );
  $json_data = $this
    ->call($command, $arg_array);
  if ($json_data) {
    $this
      ->updateCaptureSession($json_data);
    return TRUE;
  }
  return FALSE;
}