response_type
parameter includes one value:
code
: because we are using the regular web app flow, our initial request is for an authorization code; when we request our tokens using this code, we will receive the ID Token we need for authentication.scope
parameter includes three values; the requested OIDC scopes:
openid
: to indicate that the application intends to use OIDC to verify the user’s identity.profile
: to get name
, nickname
, and picture
.email
: to get email
and email_verified
.response_type
parameter still includes one value:
code
: because we are using the regular web app flow, our initial request is for an authorization code; when we request our tokens using this code, we will receive the Access Token that we can use to call our API.scope
parameter includes one value; the requested API scope:
read:appointments
: to allow us to read the user’s appointments from the API.audience
parameter is new and includes one value:
response_type
parameter still includes one value:
code
: because we are using the regular web app flow, our initial request is for an authorization code; when we request our tokens using this code, we will receive both the ID token we need for authentication and the access token that we can use to call our API.scope
parameter is used for both OIDC scopes and API scopes, so now includes four values:
openid
: to indicate that the application intends to use OIDC to verify the user’s identity.profile
: to get name
, nickname
, and picture
.email
: to get email
and email_verified
.read:appointments
: to allow us to read the user’s appointments from the API.audience
parameter includes one value:
/userinfo
endpoint (though the Action will run only during the authentication process).
Auth0 allows namespaced and non-namespaced claims, but certain restrictions apply (see General restrictions). To avoid name collisions, we recommend using namespaced claims. In case of collisions, the transaction won’t fail, but your custom claim won’t be added to your tokens.
Suppose that:
preferred_contact
method of email
and a favorite_color
of red
, and we saved it as part of the user’s user_metadata
.sub
claim contains the value of the user_id
property.favorite_color
nor user_metadata
properties are present because OpenID Connect (OIDC) does not define standard claims that represent favorite_color
or user_metadata
.Add user metadata to tokens
), select the Login / Post Login
trigger because you’ll be adding the Action to the Login flow, then select Create.
favorite_color
and preferred_contac
t custom claims in the ID Token:
api.idToken.setCustomClaims
method. To add these claims to an Access Token, use the api.accessToken.setCustomClaim
method.
To learn more about the event object for the trigger, read Actions Triggers: post-login - Event Object. To learn more about tokens, read Tokens.