Auth0 Home Blog Docs

Not getting user_id with universal login


#1

Using the universal login from a php web app. Here’s my auth0 invocation:

use Auth0\SDK\Auth0;
$auth0 = new Auth0([
  'domain' => 'ultrasoundjelly.auth0.com',
  'client_id' => '',
  'client_secret' => '',
  'redirect_uri' => 'https://www.sonoclipshare.com/ul/userverify.php',
  'audience' => 'https://ultrasoundjelly.auth0.com/userinfo',
  'scope' => 'openid profile user_metadata',
  'persist_id_token' => true,
  'persist_access_token' => true,
  'persist_refresh_token' => true,
]);

$userInfo = $auth0->getUser();
But $userInfo['user_id'] is empty. The userid is stored in $userInfo['sub'] instead. Looks like my scope is getting ignored?


#2

sub is the OIDC standard claim for the user ID.


#3

OK, that makes sense. However, when using a scope of openid email with lock10 I find the user_id under $userInfo['user_id']. Why the change?


#4

Using this scope openid email with universal login I get the $userInfo[‘sub’] still.


#5

sub is the standard, so if it was previously available with user_id, it might have been removed.