From ce11745bd0de63d3bbb4b7bcbf02d7d1f3155aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Thu, 21 Mar 2024 18:35:22 -0400 Subject: [PATCH] refactor(api): return both refresh and access tokens at login endpoint --- server/api/auth/login.post.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server/api/auth/login.post.ts b/server/api/auth/login.post.ts index e1d41a8..2207581 100644 --- a/server/api/auth/login.post.ts +++ b/server/api/auth/login.post.ts @@ -28,11 +28,14 @@ export default eventHandler(async (event) => { message: 'Account inactive!
Resend verification?', }); } - let tok = user.generateJWT(useRuntimeConfig().jwt); + let tok = user.generateRefreshToken(useRuntimeConfig().jwt); // setCookie(event, "rockfic_cookie", tok); return { user, - token: tok, + token: { + refresh: tok, + access: user.generateAccessToken(useRuntimeConfig().jwt), + }, }; } else { throw createError({ statusCode: 401, message: wrongMsg });