correction nextauth
This commit is contained in:
parent
1238deb36b
commit
6321d1623f
@ -94,9 +94,15 @@ export function clearAuthCookies() {
|
||||
const cookies = document.cookie.split(';');
|
||||
for (const cookie of cookies) {
|
||||
const [name] = cookie.split('=');
|
||||
// Only clear auth-related cookies
|
||||
if (name.trim().startsWith('next-auth.') || name.trim().startsWith('__Secure-next-auth.') || name.trim().startsWith('__Host-next-auth.')) {
|
||||
document.cookie = `${name.trim()}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
||||
const cookieName = name.trim();
|
||||
|
||||
// Only clear session cookies, NOT state/CSRF cookies needed for OAuth flow
|
||||
// State cookies are: next-auth.csrf-token, next-auth.state, etc.
|
||||
// Session cookies are: next-auth.session-token, __Secure-next-auth.session-token, etc.
|
||||
if (cookieName.startsWith('next-auth.session-token') ||
|
||||
cookieName.startsWith('__Secure-next-auth.session-token') ||
|
||||
cookieName.startsWith('__Host-next-auth.session-token')) {
|
||||
document.cookie = `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user