# 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

**URL:** <https://community.auth0.com/t/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/183443>\
**Category:** Get Help\
**Tags:** free-trial, login-experience, new-universal-login-experience\
**Created:** [March 6, 2025, 11:02am UTC](https://community.auth0.com/t/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/183443 "2025-03-06T11:02:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kartikpersistent](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/kartikpersistent/32/73462_2.png) [@kartikpersistent](https://community.auth0.com/u/kartikpersistent)\
**Post date:** [March 6, 2025, 11:02am UTC](https://community.auth0.com/t/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/183443/1 "2025-03-06T11:02:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![rueben.tiow](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/rueben.tiow/32/11646_2.png) [@rueben.tiow](https://community.auth0.com/u/rueben.tiow)\
**Post date:** [March 10, 2025, 8:21pm UTC](https://community.auth0.com/t/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/183443/3 "2025-03-10T20:21:27Z")

</div>

Hi @kartikpersistent,

Thanks for the question.

You could accomplish this using the Auth0 React SDK by using the [`isLoading`](https://auth0.github.io/auth0-react/interfaces/Auth0ContextInterface.html#isLoading) and [`isAuthenticated`](https://auth0.github.io/auth0-react/interfaces/Auth0ContextInterface.html#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

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [March 24, 2025, 8:21pm UTC](https://community.auth0.com/t/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/183443/4 "2025-03-24T20:21:59Z")

</div>

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