Prevent going back to universal login page after logging in when user clicks browser back

This is for my ReactJS project I’m currently working on.
I have it setup to use universal login page for user to log in and redirect back to my website (localhost).
Is there a way to prevent the user from going back to the universal login page when user uses browser back button after logging in?

Right now, user can go back all the way to before they clicked the login button, and user is still logged in which is good (probably due to silent login). But I would like to prevent this somewhat weird steps.

Hi @choe132,

Welcome to the Community!

You could use the loginWithPopup method instead of loginWithRedirect? This means the page/tab never goes to the login. Otherwise you are kind of at the mercy of the browser. Checkout this thread for more info:

1 Like

Actually, yeah loginWithPopup() works for me and solves my issue. Thanks!

I guess it’s more for my curiosity now, but would you know how most SPAs handle this situation then without trying to mess with browser’s behavior?

Can you take a screen capture of the exact behavior?

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