ID Token for Open ID Connect

Hey @Kush1 !

Do user’s have a given_name and family_name in Auth0? If so, I believe these claims should be included in ID tokens by default if including the profile scope when calling the authorize endpoint.

If not, here’s a Post Login Action that should do the trick:

exports.onExecutePostLogin = async (event, api) => {
  const namespace = 'https://yournamespace.com/'; // Replace with a unique identifier URL
  if (event.user.given_name) {
    api.idToken.setCustomClaim(`${namespace}given_name`, event.user.given_name);
  }
  if (event.user.family_name) {
    api.idToken.setCustomClaim(`${namespace}family_name`, event.user.family_name);
  }
};

1 Like