I have 2 user types free read-only users and paid read and write access users. To model this in Auth0 I have 2 roles created and all the relevant permissions defined.
I want users to be able to register and depending on which registration flow they embark on I want them to be assigned to the corresponding Auth0 user role.
How can this be done?
- Can I indicate in the /authorize endpoint which role they are registering for?
- I know I can use the management API from my application, but that means their existing auth token will be outdated.
Hi @baynezy,
To answer your questions:
- To add custom parameters to your sign-up flow, you can use the AuthorizationParams interface in the auth0-spa-js library.
- You’re right about the auth token expiring. You can use Auth0 Actions instead, specifically Post User Registration or Post Login. The role assignment happens during the authentication flow, which means that when the user is redirected back to your application, the tokens issued by Auth0 will already contain the newly assigned roles.
If you have any other questions, feel free to reach out.
Have a good one,
Vlad
Thanks @vlad.murarasu - I am using Blazor WASM. So I will have to try and work out how do the equivalent of that in .Net.
Cheers.
1 Like