You are here

public function OpenIDConnectClientBase::decodeIdToken in OpenID Connect / OAuth client 8

Decodes ID token to access user data.

Parameters

string $id_token: The encoded ID token containing the user data.

Return value

array User identity information.

Overrides OpenIDConnectClientInterface::decodeIdToken

3 methods override OpenIDConnectClientBase::decodeIdToken()
OpenIDConnectFacebookClient::decodeIdToken in src/Plugin/OpenIDConnectClient/OpenIDConnectFacebookClient.php
Decodes ID token to access user data.
OpenIDConnectGithubClient::decodeIdToken in src/Plugin/OpenIDConnectClient/OpenIDConnectGithubClient.php
Decodes ID token to access user data.
OpenIDConnectLinkedinClient::decodeIdToken in src/Plugin/OpenIDConnectClient/OpenIDConnectLinkedinClient.php
Decodes ID token to access user data.

File

src/Plugin/OpenIDConnectClientBase.php, line 370

Class

OpenIDConnectClientBase
Base class for OpenID Connect client plugins.

Namespace

Drupal\openid_connect\Plugin

Code

public function decodeIdToken($id_token) {
  list(, $claims64, ) = explode('.', $id_token);
  $claims64 = str_replace([
    '-',
    '_',
  ], [
    '+',
    '/',
  ], $claims64);
  $claims64 = base64_decode($claims64);
  return json_decode($claims64, TRUE);
}