Hi! I’ve tried to add custom claims (role assigned to the user) to my token by following the documentation: Add user roles to ID and Access tokens. However, I can see in the token returned to my web app that these claims are not inserted. I think this is due to the fact the object event.authorization is null.
However, when I create an action that does the same:
Hello,
It’s possible that the event.authorization object is null because it is not available at the time the custom claims are being added to the token. According to the documentation you linked, the event.authorization object is only available for certain event types, such as sso or user signed up.
On the other hand, the context object is available at various points during the authentication flow, and includes information about the current user and their authentication state. It’s possible that the context.authorization object is populated with the necessary information needed to add the custom claims to the token.
Without more information about your specific authentication flow and how it’s configured, it’s hard to say for sure why event.authorization is null in one case and not the other. However, using the context object to add custom claims is a valid approach and is documented by Auth0. hope so it is beneficial for you . Clover Dashboard Login
As this topic is related to Rules - Hooks - Actions and Rules & Hooks are being deprecated soon I’m excited to let you know about our next Ask me Anything session in the Forum on Thursday, January 18 with the Rules, Hooks and Actions team on Rules & Hooks and why Actions matter! Submit your questions in the thread above and our esteemed product experts will provide written answers on January 18. Find out more about Rules & Hooks and why Actions matter! Can’t wait to see you there!