Auth0 Home Blog Docs

Get id_token in php app

auth0
php

#1

Trying to get and decode the user’s id_token so I can get access to some data passed by a Rule:
context.idToken[namespace + 'access_token']. I’m using the PHP SDK:

$auth0 = new Auth0([
  'domain'        => getenv('AUTH0_DOMAIN'),
  'client_id' => getenv('AUTH0_CLIENT_ID'),
  'client_secret' => getenv('AUTH0_CLIENT_SECRET'),
  'redirect_uri'  => getenv('AUTH0_CALLBACK_URL'),
  'audience' => 'https://ultrasoundjelly.auth0.com/userinfo',
  'scope' => 'profile openid email',
  'persist_id_token' => true,
  'persist_access_token' => true,
  'persist_refresh_token' => true
]);

Although I did find this on decoding the JWT, I cannot find any documentation on how to get this token into my app using this SDK.

Thanks


#2

Found it $auth0->getIdToken();


#3

Glad you got it figured out, thanks for checking back in!