If user is not authenticated I want to to navigate the user to different route but login page how to achieve this behavior in auth0 for react

I have a scenario where I want to navigate the user to different route rather then redirecting to login page of auth 0 is there any option to pass the route name in with Authentication guard
type: SPA

1 Like

Hi @kartikpersistent,

Thanks for the question.

You could accomplish this using the Auth0 React SDK by using the isLoading and isAuthenticated properties to verify if the user has an active authentication state.

If isAuthenticated is false after isLoading is complete, you can redirect the user back to your preferred route.

Otherwise, if they are authenticated, you can display their user profile or send them to callback URL.

Thanks,
Rueben

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