mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 23:11:12 -05:00
feat: Add force logout endpoint
This commit is contained in:
@@ -156,6 +156,37 @@ class AuthStorage {
|
||||
: null
|
||||
};
|
||||
}
|
||||
|
||||
// Clear all auth-related storage (for force logout)
|
||||
clearAll(): void {
|
||||
console.log('[AuthStorage] Clearing all auth storage');
|
||||
try {
|
||||
if (this.storage) {
|
||||
// Get all keys from storage
|
||||
const keys: string[] = [];
|
||||
for (let i = 0; i < this.storage.length; i++) {
|
||||
const key = this.storage.key(i);
|
||||
if (key?.startsWith('sb-')) {
|
||||
keys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all Supabase auth keys
|
||||
keys.forEach(key => {
|
||||
console.log('[AuthStorage] Removing key:', key);
|
||||
this.storage!.removeItem(key);
|
||||
});
|
||||
}
|
||||
|
||||
// Clear memory storage
|
||||
this.memoryStorage.clear();
|
||||
console.log('[AuthStorage] ✓ All auth storage cleared');
|
||||
} catch (error) {
|
||||
console.error('[AuthStorage] Error clearing storage:', error);
|
||||
// Still clear memory storage as fallback
|
||||
this.memoryStorage.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const authStorage = new AuthStorage();
|
||||
|
||||
Reference in New Issue
Block a user