Automatically adding permissions to JWT on first login

Hi,

I’m trying to ensure that users have a given role automatically added when they register.

Initially, I tried to do this with a “Post User Registration” hook but that never worked. (I don’t have an auth0 object available to me with a management access token in a hook it seems…)

Then, I used the code provided in this FAQ to do it when they first logged in at least, and that worked.

However, the first JWT that gets returned does NOT have the permissions associated to the added role. I noticed people were having the same issue as me in this ticket…. However, I wasn’t super happy with the proposed solution of simply getting more tokens until one has the permissions…

So I’m sorta stuck atm. Does anyone have a way for a user’s JWT to contain the permissions associated with a role in the FIRST login?

Got it working by assigning the role to the user in the “Post User Registration” hook.

Was never able to make this work inside a rule, which is fine, I think the hook solution is more elegant.

Feel free to close.

1 Like

Thanks for following up!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.