You are here

protected function JanrainCaptureApi::refreshTokenReveal in Janrain Registration 7

Same name and namespace in other branches
  1. 6 janrain_capture.api.inc \JanrainCaptureApi::refreshTokenReveal()
  2. 7.3 includes/janrain_capture.api.inc \JanrainCaptureApi::refreshTokenReveal()

Helper function to decode a refresh token using a pad from a cookie.

Parameters

string $protcted_refresh_token: The base64 encoded, encrypted token.

Return value

mixed A plain text token string, or NULL on failure.

1 call to JanrainCaptureApi::refreshTokenReveal()
JanrainCaptureApi::refreshAccessToken in ./janrain_capture.api.inc
Retrieves a new access_token/refresh_token set

File

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

protected function refreshTokenReveal($protected_refresh_token) {
  $raw_refresh_token = NULL;
  $bin = base64_decode($protected_refresh_token);
  if ($bin && isset($_COOKIE['janrain_capture_pad'])) {
    $pad = base64_decode($_COOKIE['janrain_capture_pad']);
    if ($pad && strlen($bin) == strlen($pad)) {
      $raw_refresh_token = $bin ^ $pad;
    }
  }
  return $raw_refresh_token;
}