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
Using signOut() with multiple tabs open I discovered that sometimes the user was not getting logged out. While the /session call initially returns an empty object subsequent calls would return the user's session again failing to log out the user. This was happening because on logout my application would redirect to a specific logout page where we check if the user is authenticated by calling /session that was authenticating the user again. This is reproducible on the official example as well if we reload one of the tabs after calling sign out from the other.
How to reproduce
I reproduced the issue with the official next-auth-example project. Steps to reproduce:
Environment
System: OS: macOS 12.3.1 CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 1.18 GB / 32.00 GB Shell: 5.8 - /bin/zsh Binaries: Node: 14.17.0 - ~/.nvm/versions/node/v14.17.0/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 8.5.5 - ~/.nvm/versions/node/v14.17.0/bin/npm Watchman: 2022.03.21.00 - /usr/local/bin/watchman Browsers: Chrome: 101.0.4951.64 Edge: 101.0.1210.53 Firefox: 100.0.2 Safari: 15.4 npmPackages: next: ^12.0.11-canary.4 => 12.1.6 next-auth: latest => 4.3.4 react: ^17.0.2 => 17.0.2Reproduction URL
https://next-auth-example.vercel.app
Describe the issue
Using
signOut()with multiple tabs open I discovered that sometimes the user was not getting logged out. While the/sessioncall initially returns an empty object subsequent calls would return the user's session again failing to log out the user. This was happening because on logout my application would redirect to a specific logout page where we check if the user is authenticated by calling/sessionthat was authenticating the user again. This is reproducible on the official example as well if we reload one of the tabs after calling sign out from the other.How to reproduce
I reproduced the issue with the official next-auth-example project. Steps to reproduce:
Current behavior:
The signout endpoint responds with a 200 status however the session is not cleared and the user is still logged in.
Video:
Screen.Recording.2022-05-23.at.7.52.05.PM.mov
Expected behavior
The user should be logged out or the
/signoutAPI should respond with an error code.