After a user logs in, I must redirect him to a specific route based on his user role.
Should this be implemented in the Auth0 Actions or our React Application?
I’ve tried setting properties to the idToken and the accessToken in the auth0 post login actions, but I’ve had no luck retrieving them on the front end so far.
Is this the way to go, or should I do this in our react application?
If this is the way to go, why am i not able to attach the user-role property to the tokens?
I’ve also tried to use the api.redirect function, but no luck there as well. I couldn’t find concrete examples regarding my use case.
For now, the roles variable has a hardcoded value like: const roles = 'test'; // or ['test']; Ideally, I would fetch the user role somehow from auth0, but I can get back to that later.
From what I understood, i need to do:
Call api.redirect.sendUserTo() in the onExecutePostLogin, in my case sendUserTo('localhost:3000/organizations
Then, in my application when the /organizations route is called, I need to navigate the user to https://my-auth-domain.com
Then i need to do something in the onContinuePostLogin script, which im not sure why.
I am not quite clear if these are the correct steps, and if they are, im not exactly sure what i need to do in the onContinuePostLogin script, and what kind of data do i need to pass to that script, and to the /continue route.
I can revisit this tomorrow and get back with more details if needed.