2121import { BrandingPreference , AsgardeoRuntimeError , IdToken , Organization , User , UserProfile } from '@asgardeo/node' ;
2222import { AsgardeoProviderProps } from '@asgardeo/react' ;
2323import { FC , PropsWithChildren , ReactElement } from 'react' ;
24+ import clearSession from './actions/clearSession' ;
2425import createOrganization from './actions/createOrganization' ;
2526import getAllOrganizations from './actions/getAllOrganizations' ;
2627import getBrandingPreference from './actions/getBrandingPreference' ;
@@ -32,6 +33,7 @@ import getUserAction from './actions/getUserAction';
3233import getUserProfileAction from './actions/getUserProfileAction' ;
3334import handleOAuthCallbackAction from './actions/handleOAuthCallbackAction' ;
3435import isSignedIn from './actions/isSignedIn' ;
36+ import refreshToken from './actions/refreshToken' ;
3537import signInAction from './actions/signInAction' ;
3638import signOutAction from './actions/signOutAction' ;
3739import signUpAction from './actions/signUpAction' ;
@@ -48,6 +50,20 @@ import {SessionTokenPayload} from '../utils/SessionManager';
4850 */
4951export type AsgardeoServerProviderProps = Partial < AsgardeoProviderProps > & {
5052 clientSecret ?: string ;
53+ /**
54+ * Session cookie lifetime in seconds. Determines how long the session cookie
55+ * remains valid in the browser after sign-in.
56+ *
57+ * Resolution order (first defined value wins):
58+ * 1. This prop — set here when mounting the provider.
59+ * 2. `ASGARDEO_SESSION_COOKIE_EXPIRY_TIME` environment variable.
60+ * 3. Built-in default of 86400 seconds (24 hours).
61+ *
62+ * @example
63+ * // 8-hour session cookie
64+ * <AsgardeoServerProvider sessionCookieExpiryTime={28800} ... />
65+ */
66+ sessionCookieExpiryTime ?: number ;
5167} ;
5268
5369/**
@@ -99,7 +115,7 @@ const AsgardeoServerProvider: FC<PropsWithChildren<AsgardeoServerProviderProps>>
99115 // Try to get session information from JWT first, then fall back to legacy
100116 const sessionPayload : SessionTokenPayload | undefined = await getSessionPayload ( ) ;
101117 const sessionId : string = sessionPayload ?. sessionId || ( await getSessionId ( ) ) || '' ;
102- const signedIn : boolean = sessionPayload ? true : await isSignedIn ( sessionId ) ;
118+ const signedIn : boolean = await isSignedIn ( sessionId ) ;
103119
104120 let user : User = { } ;
105121 let userProfile : UserProfile = {
@@ -203,6 +219,8 @@ const AsgardeoServerProvider: FC<PropsWithChildren<AsgardeoServerProviderProps>>
203219 applicationId = { config ?. applicationId }
204220 baseUrl = { config ?. baseUrl }
205221 signIn = { signInAction }
222+ clearSession = { clearSession }
223+ refreshToken = { refreshToken }
206224 signOut = { signOutAction }
207225 signUp = { signUpAction }
208226 handleOAuthCallback = { handleOAuthCallbackAction }
0 commit comments