Skip to content

Make session cookie expiration configurable in @asgardeo/nextjs SDK #439

@HasiniSama

Description

@HasiniSama

Description

The @asgardeo/nextjs SDK (v0.2.5) currently uses a hardcoded session cookie expiration of 3600 seconds (1 hour). In SessionManager.ts, the getSessionCookieOptions method sets this value using the DEFAULT_EXPIRY_SECONDS constant [1].

As a result, the session cookie expires after one hour regardless of OIDC token validity. The SDK also does not support refresh tokens or sliding sessions, so the session cannot be extended beyond this fixed duration.

It would be useful to make the session expiration configurable or align it with token/session validity, and to consider support for refresh tokens or sliding sessions.

[1]

static getSessionCookieOptions(): {
httpOnly: boolean;
maxAge: number;
path: string;
sameSite: 'lax';
secure: boolean;
} {
return {
httpOnly: true,
maxAge: this.DEFAULT_EXPIRY_SECONDS,
path: '/',
sameSite: 'lax' as const,
secure: process.env['NODE_ENV'] === 'production',
};
}

Steps to Reproduce

N/A

Please select the area the issue is related to

@asgardeo/nextjs

Version

v0.2.5

Environment Details (with versions)

No response

Reporter Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided all the necessary information.
  • I have tested the issue on the latest version of the package.

Metadata

Metadata

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions