You are here

public function Auth0::setIdToken in Auth0 Single Sign On 8.2

Sets, validates, and persists the ID token.

Parameters

string $idToken - ID token returned from the code exchange.:

Return value

\Auth0\SDK\Auth0

Throws

CoreException

Exception\InvalidTokenException

2 calls to Auth0::setIdToken()
Auth0::exchange in vendor/auth0/auth0-php/src/Auth0.php
Exchange authorization code for access, ID, and refresh tokens
Auth0::renewTokens in vendor/auth0/auth0-php/src/Auth0.php
Renews the access token and ID token using an existing refresh token. Scope "offline_access" must be declared in order to obtain refresh token for later token renewal.

File

vendor/auth0/auth0-php/src/Auth0.php, line 669

Class

Auth0
Class Auth0 Provides access to Auth0 authentication functionality.

Namespace

Auth0\SDK

Code

public function setIdToken($idToken) {
  $jwtVerifier = new JWTVerifier([
    'valid_audiences' => !empty($this->idTokenAud) ? $this->idTokenAud : [
      $this->clientId,
    ],
    'supported_algs' => $this->idTokenAlg ? [
      $this->idTokenAlg,
    ] : [
      'HS256',
      'RS256',
    ],
    'authorized_iss' => $this->idTokenIss ? $this->idTokenIss : [
      'https://' . $this->domain . '/',
    ],
    'client_secret' => $this->clientSecret,
    'secret_base64_encoded' => $this->clientSecretEncoded,
    'guzzle_options' => $this->guzzleOptions,
  ]);
  $this->idTokenDecoded = (array) $jwtVerifier
    ->verifyAndDecode($idToken);
  if (in_array('id_token', $this->persistantMap)) {
    $this->store
      ->set('id_token', $idToken);
  }
  $this->idToken = $idToken;
  return $this;
}