How to redirect users to same page after log in

Is there a way a user after successful log in redirect to the exact same page .
I am able to redirect to any one page by hardcoding the route.
But in my case I want the user to redirect to exactly the same page .
Thanks ,

Hey there!

Can you explain a bit more about the usecase? Why you want to redirect logged in user to a page where they can login?

I think you got my question wrong.
Suppose I am in /browse route and unauthenticated .
If I click on login button from the navigation bar , I will be taken too login page . after login is done .
I want the user to go back to /browse page only .
Similarly for any route , the user should stay on that route only after the login is completed .

Coming to the use case .
Coinsider you are buying shoes online , that route will be /products/shoes.
Something like .As he click on buy button , he is asked to login .After the log in is done , you wouldn’t want the user to go back to landing page right ?

1 Like

Hello Hussam,
Thanks for explaining your usecase & it looks like you’re looking to restore the application state after user successfully authenticated.

Below page has details on how to implement it

However, depending on the Auth0 SDKs you’re using this is supported OOB, for example to implement in auth0-spa-js SDK you could leverage appState

1 Like

Thanks a lot @praveen.addepally for helping on that!

did you find a solution? because I’m struggling with the exact same problem right now…

Hey there Julius!

Have you had a chance to check what @praveen.addepally shared?

Ping ping friendly ping :slight_smile:

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