WIP - fix browser refresh not holding user authentication

This commit is contained in:
Francisco Gaona
2026-02-04 08:55:08 +01:00
parent 0e2f3dddbc
commit 49a571215d
4 changed files with 49 additions and 17 deletions

View File

@@ -56,15 +56,15 @@ export default defineEventHandler(async (event) => {
setSessionCookie(event, access_token)
// Set tenant ID cookie (readable by client for context)
if (tenantId) {
setTenantIdCookie(event, tenantId)
}
// Use tenantId from response, or fall back to subdomain
const tenantToStore = tenantId || subdomain
setTenantIdCookie(event, tenantToStore)
// Return user info (but NOT the token - it's in HTTP-only cookie)
return {
success: true,
user,
tenantId,
tenantId: tenantToStore,
}
} catch (error: any) {
// Re-throw H3 errors