Hey guys, I have an dashbaoard page which is protected page, it is only accessible if there is some auth cookie else it will redirect user to login page.
Let say I am in some dashboard/settings page or some other protected page and user gets logout by clearing cookies and all auth related data and user gets redirected to the login page. But if use try to goback than it takes the user to dashboard page and all pages which acces. Intried with router.replace but than its working as same.
How should I handle this scenario
#How to prevents user to go back once logout
1 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
You use middleware for this
By checking the path for anything matching the parent protected route
And in thr server component you double check if their auth otherwise call redirect
Yes middleware is working but don’t know why not working when going back
Could be due to some caching wirh fetching permission or renewing sessions/tokens. not really sure without seeing the code for the file