We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0fbf449 commit 93e9748Copy full SHA for 93e9748
1 file changed
packages/nextjs/src/server/actions/refreshToken.ts
@@ -91,7 +91,11 @@ const refreshToken = async (): Promise<RefreshResult> => {
91
logger.warn('[refreshToken] Could not write session cookie — called from SSR rendering context.');
92
}
93
94
- const expiresInSeconds: number = parseInt(result.tokenResponse.expiresIn, 10);
+ const rawExpiresIn: string | undefined = result.tokenResponse.expiresIn;
95
+ const expiresInSeconds: number = parseInt(rawExpiresIn ?? '', 10);
96
+ if (isNaN(expiresInSeconds)) {
97
+ throw new Error(`[refreshToken] Invalid expiresIn value received: ${rawExpiresIn}`);
98
+ }
99
const expiresAt: number = Math.floor(Date.now() / 1000) + expiresInSeconds;
100
101
logger.debug('[refreshToken] Token refresh succeeded.');
0 commit comments