Adding Custom Claims to ID Tokens with Auth0 Actions

Learn how to create a new custom action that will add a custom claim to your Auth0-issued ID Token.
Read more…

:writing_hand:t2: Brought to you by @jesstemporal

1 Like

Howdy folks! Got any questions regarding the article? Let us know if you have any questions on this front!

Thanks for the article, it was really helpful, but i have a question, i tried to set the custom claim name to anything other than an URL but it never works, why does it have to be a URL? Is there any configuration to allow it to be just a string?

@jesstemporal would you be able to help us here? Thanks!

This topic was automatically closed after 31 days. New replies are no longer allowed.

Hi @ahmad sorry it took this long to get back to you on this, I momentarily lost access to this forum.

He have to use a “URL” as the custom claim name to avoid collision with reserved and other claims from other resources.

So that’s why it has to be following the URL format.

1 Like

Thanks for the followup Jess!

1 Like

Hi Jess,

This was a really useful article, thanks! I’m trying to implement something similar using Passwordless login and the React SDK, but I need to pass a value to the Action to be added to the Id token instead of using a random on in your example.

Do you have any pointers on how to do this? I’ve tried manually passing in the value as part of the user_metadata to the passwordlessLogin call, but it isn’t then available in the Action.

          webAuth.passwordlessLogin(
            {
              connection: "email",
              email: emailAddress.value,
              verificationCode: otpCode.value,
              user_metadata: {myCustomValue: "custom_value"}
            },

Tagging you @jesstemporal for visibility