Hi, Currently im in a situation where i need to update user’s custom claim in the access token. The scenario wont pass through any action/flow in auth0, so I have no idea how to update the custom claim for the token. Need guidance about this, appreciate for any advice
Hi @khawmingsheng,
Thanks for reaching out to the Auth0 Community!
I recommend reading our Adding custom claims to tokens FAQ which explains how to add custom claims to tokens.
If you have any questions about the implementation, please feel free to ask.
Thanks,
Rueben
Hi Rueben, the faq just show how to add it inside a flow, but im at the point where wont trigger any action/flow…
Hi @khawmingsheng,
Thank you for your reply.
I have tested it myself and was able to successfully trigger the Post-Login Action flow.
Could you please try using the built-in Actions debugger to see if the Action script has any issues?
I would also recommend using console.log()
statements in your Action script with the Real-time Webtask Logs Extension to track the state of your Action.
If you are still having issues, could you please share an example of your Action script with sensitive data removed with me?
Thanks,
Rueben
Hi rueben, thanks for reply.
You have misunderstood me. The scenrario is when the user already logged in, and been for awhile. so its way passed the “post login action” flow stage.
what I need is a a way for user to update the token custom claim whenever they (e.g.: clicked a button).
is there any way to achieve this?
Hi @khawmingsheng,
Thank you for your reply and clarification.
What you have observed is an existing session with an old state. In this case, the session would need to be “refreshed” since the user that was previously (and still) logged in has an access token with the claims issued at the time of authentication.
For this, I recommend using reading our Refresh Tokens documentation get a new access token with the updated claims without user interaction.
Please let me know if you have any additional questions.
Thanks,
Rueben
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.