diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 3e199750401d7efb60d7160645c7cd039cbf17f7..334d6c3b7f460c34fc0c9b5029e8a238b5687174 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -121,11 +121,13 @@ export const authOptions: AuthOptions = { async jwt({ token, account, profile }): Promise<JWT> { // The "account" is only available right after signing in -- adding useful data to the token if (account) { - token.accessToken = account.access_token; - token.refreshToken = account.refresh_token; - token.accessTokenExpires = account.expires_at as number; - - token.profile = profile as WfoUserProfile; + return { + ...token, + accessToken: account.access_token, + refreshToken: account.refresh_token, + accessTokenExpires: account.expires_at as number, + profile: profile as WfoUserProfile, + }; } const now = Math.floor(Date.now() / 1000);