Open chaichontat opened 6 months ago
This is causing a big bug for me. If a user deletes their account, the app still thinks they're logged in. If they want to create a new account, I have to tell them to uninstall and re-install the app. This has resulted in my app receiving negative feedback.
Please can the supabase team look into this urgently?
I'm having the same issue, the signOut function doesn't work when the token has expired or when i close the session in other device.
I found a temp solution, you need to create a route handler and if the logout failed, you can redirect to this route: /auth/signout
export async function GET(req) { cookies().delete("your-cookie-name"); return NextResponse.redirect(new URL("/login", req.url), { status: 302, }); }
` const supabase = createClient(); const { data, error } = await supabase.auth.getUser();
if (error) {
const { error: erroruser } = await supabase.auth.signOut({
revocation: true,
});
if (erroruser) {
redirect("/auth/signout");
}
console.log("error signoyt", erroruser);
}`
This is my current mitigation by forcibly removing all cookies when signOut
is called.
try {
await event.locals.supabase.auth.signOut({ scope: "local" });
} catch (e) {
console.error(e);
}
// https://github.com/supabase/auth-helpers/issues/778
event.cookies.getAll().forEach((cookie) => {
event.cookies.delete(cookie.name, { path: "/" });
});
hi @chaichontat, which version of supabase-js are you on? we fixed this in https://github.com/supabase/auth-js/pull/894
Bug report
Describe the bug
supabase.auth.signOut
does not remove storage/cookies when a session has been revoked. This meant the client retains a session and a (potentially) unexpired JWT.This is a known issue in different
auth
repos and is recently fixed inauth-js
: https://github.com/supabase/auth-js/pull/894. https://github.com/supabase/auth/issues/1550 https://github.com/supabase/auth/issues/1518 https://github.com/orgs/supabase/discussions/9327To Reproduce
Steps to reproduce the behavior, please provide code snippets or a repository:
auth
table using the supabase console.supabase.auth.signOut
returnserror: AuthApiError: Session from session_id claim in JWT does not exist
and does not clear storage or cookies.Expected behavior
supabase.auth.signOut
should clear storage/cookies regardless of return from the supabase server.System information