How to sign the user out when /logout is visited?
In my Next.js App Router application, I'd like to automatically sign the user out when the user visits
/logout
. This could be helpful if the user is stuck in some weird UI state due to a bug, or the "Sign out" button is not rendered for some reason.
Having a simple /logout
page to reset the auth could be a time saver at times.
How could I achieve this?1 Reply
redirect("/api/auth/logout")
seems to do the job 👍