diff --git a/packages/api/src/routers/auth/auth_router.ts b/packages/api/src/routers/auth/auth_router.ts index ad19c9b1e..693e3861c 100644 --- a/packages/api/src/routers/auth/auth_router.ts +++ b/packages/api/src/routers/auth/auth_router.ts @@ -420,6 +420,13 @@ export function authRouter() { // set auth cookie in response header await setAuthInCookie({ uid: user.id }, res) + const cookie = res.get('cookie') + if (!cookie) { + return res.redirect( + `${env.client.url}/email-login?errorCodes=${LoginErrorCode.AuthFailed}` + ) + } + res.setHeader('set-cookie', cookie) await handleSuccessfulLogin(req, res, user, false) } catch (e) { logger.info('email-login exception:', e)