You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building an authentication flow in a Next.js app, and I'm facing an issue with redirecting users to the sign-in page after they sign out. Here’s a summary of the problem:
Current Flow: When the user clicks the "Sign out" button on the /settings page which is protected, they are logged out, and the page shows the sign-in UI. However, the URL does not update to /auth/signin as expected. Instead, it still shows /settings.
Expected Behavior: After signing out, I want the user to be redirected to the /auth/signin page, and the URL should reflect this change immediately. It is redirecting find while doing signIn from /atuh/signin to /settings.
Issue: The sign-in page is displayed, but the URL only updates to /auth/signin after a manual page refresh. This is confusing because the user sees the sign-in content, but the URL is misleading.
Code Snippet
Here’s a simplified version of my sign-out handler:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building an authentication flow in a Next.js app, and I'm facing an issue with redirecting users to the sign-in page after they sign out. Here’s a summary of the problem:
/settings
page which is protected, they are logged out, and the page shows the sign-in UI. However, the URL does not update to/auth/signin
as expected. Instead, it still shows/settings
./auth/signin
page, and the URL should reflect this change immediately. It is redirecting find while doingsignIn
from/atuh/signin
to/settings
./auth/signin
after a manual page refresh. This is confusing because the user sees the sign-in content, but the URL is misleading.Code Snippet
Here’s a simplified version of my sign-out handler:
Screenshots
Before Sign-out:

/settings
page with user information.After Clicking Sign-out: Sign-in page content is shown, but the URL is still

/settings
.After Manual Reload: URL updates to

/auth/signin
as expected.Questions
/auth/signin
without requiring a page reload?Any guidance would be much appreciated! Thank you.
Beta Was this translation helpful? Give feedback.
All reactions