Skip to content

Commit 7fda321

Browse files
authored
chore: add log and fix missing session expiration (#1039) RELEASE
add log to see if fallback happens and consider missing session expiration
1 parent 76e4946 commit 7fda321

File tree

2 files changed

+7
-4
lines changed
  • packages/sdks

2 files changed

+7
-4
lines changed

packages/sdks/nextjs-sdk/src/server/session.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const extractSession = (
2424
const getSessionFromCookie = async (
2525
config?: CreateSdkParams
2626
): Promise<AuthenticationInfo | undefined> => {
27+
console.debug('attempting to get session from cookie');
2728
try {
2829
const sessionCookie = (await cookies()).get(
2930
descopeSdk.SessionTokenCookieName
@@ -33,8 +34,7 @@ const getSessionFromCookie = async (
3334
return undefined;
3435
}
3536
const sdk = getGlobalSdk(config);
36-
const res = await sdk.validateJwt(sessionCookie.value);
37-
return res;
37+
return await sdk.validateJwt(sessionCookie.value);
3838
} catch (err) {
3939
console.debug('Error getting session from cookie', err);
4040
return undefined;

packages/sdks/web-js-sdk/src/enhancers/withNotifications/index.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ export const withNotifications =
3434
await getAuthInfoFromResponse(res);
3535
if (sessionJwt) sessionPS.pub(sessionJwt);
3636

37-
if (sessionExpiration) {
38-
sessionExpirationPS.pub(sessionExpiration);
37+
if (sessionExpiration || sessionJwt) {
38+
// We also publish the session expiration if there is a session jwt
39+
// as a temporary fix for the issue where the session expiration is not
40+
// being sent in the response in Flows (42 is a magic number)
41+
sessionExpirationPS.pub(sessionExpiration || 42);
3942
}
4043
}
4144
};

0 commit comments

Comments
 (0)