From 6ef4da125d8da16676f729c57513ec96041f2d7b Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Wed, 14 Aug 2024 11:16:48 +0200 Subject: [PATCH] feat(SW-162): MFA expiry set with token expiry --- auth.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/auth.ts b/auth.ts index 4eb9aaca0..fa5c824e9 100644 --- a/auth.ts +++ b/auth.ts @@ -109,12 +109,13 @@ export const config = { const mfa_scope = profile?.amr == "urn:se:curity:authentication:otp-authenticator:OTP-Authenticator_web" - const mfa_expires_at = mfa_scope ? Date.now() + 10 * 60 * 1000 : 0 + const tokenExpiry = account.expires_at + ? account.expires_at * 1000 + : undefined + const mfa_expires_at = mfa_scope && tokenExpiry ? tokenExpiry : 0 return { access_token: account.access_token, - expires_at: account.expires_at - ? account.expires_at * 1000 - : undefined, + expires_at: tokenExpiry, refresh_token: account.refresh_token, loginType, mfa_scope: mfa_scope,