After login if user press back button error appears, Nextjs App

When Someone log in from the login page provided by the authO system smoothly redirects to given url, but if some dumb user press back button after logging in an error appears from the authO side saying:

" invalid_request: You may have pressed the back button, refreshed during login, opened too many login dialogs, or there is some issue with cookies, since we couldn’t find your session. Try logging in again from the application and if the problem persists please contact the administrator.

TRACKING ID: eb04360f300430f42eaS"

I want to know how i can handle this issue?

Hello Talha,

You can configure the Configure Default Login Routes to redirect users who press the back button or bookmark the login page.

Alternatively, you can redirect users to your own customized error page on which you can configure custom logic on how to process certain errors.

I hope this helps!


I have tried to set Custom error page but it wont allowing me to set my localhost:300 url as the project is still in production face i dont have a domain for it.

is there any way i can set localhost:300/MyErrorPage as an custom error page?