File length: 18902 # References - Frontend SDKs - React SDK Reference - Session Source: https://supertokens.com/docs/references/frontend-sdks/supertokens-auth-react/recipe-session ## Classes ### BooleanClaim Defined in: [claims/booleanClaim.ts:6](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/booleanClaim.ts#L6) #### Extends - [`SuperTokensWrapper`](index.mdx#supertokenswrapper-1) #### Constructors ##### Constructor ```ts new BooleanClaim(config): BooleanClaim; ``` Defined in: [claims/booleanClaim.ts:7](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/booleanClaim.ts#L7) ###### Parameters | Parameter | Type | | ------ | ------ | | `config` | `any` | ###### Returns [`BooleanClaim`](#booleanclaim) ###### Overrides ```ts BooleanClaimWebJS.constructor ``` *** ### default Defined in: [recipe/session/index.ts:34](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L34) #### Constructors ##### Constructor ```ts new default(): default; ``` ###### Returns [`default`](#default) #### Properties | Property | Modifier | Type | Default value | Defined in | | ------ | ------ | ------ | ------ | ------ | | `ComponentsOverrideProvider` | `static` | `any` | `RecipeComponentsOverrideContextProvider` | [recipe/session/index.ts:112](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L112) | | `SessionAuth` | `static` | `any` | `SessionAuthWrapper` | [recipe/session/index.ts:38](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L38) | | `useClaimValue` | `static` | \<`T`\>(`claim`) => \| \{ `loading`: `true`; \} \| \{ `doesSessionExist`: `boolean`; `loading`: `false`; `value`: `T`; \} | `useClaimValueFunc` | [recipe/session/index.ts:36](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L36) | | `useSessionContext` | `static` | () => [`SessionContextType`](recipe-session-types.mdx#sessioncontexttype) | `useSessionContextFunc` | [recipe/session/index.ts:35](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L35) | #### Methods ##### ~~addAxiosInterceptors()~~ ```ts static addAxiosInterceptors(axiosInstance, userContext?): void; ``` Defined in: [recipe/session/index.ts:75](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L75) ###### Parameters | Parameter | Type | | ------ | ------ | | `axiosInstance` | `any` | | `userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `void` ###### Deprecated ##### attemptRefreshingSession() ```ts static attemptRefreshingSession(): Promise; ``` Defined in: [recipe/session/index.ts:62](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L62) ###### Returns `Promise`\<`boolean`\> ##### doesSessionExist() ```ts static doesSessionExist(input?): Promise; ``` Defined in: [recipe/session/index.ts:66](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L66) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`boolean`\> ##### getAccessToken() ```ts static getAccessToken(input?): Promise; ``` Defined in: [recipe/session/index.ts:50](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L50) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`string`\> ##### getAccessTokenPayloadSecurely() ```ts static getAccessTokenPayloadSecurely(input?): Promise; ``` Defined in: [recipe/session/index.ts:56](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L56) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`any`\> ##### getClaimValue() ```ts static getClaimValue(input): Promise; ``` Defined in: [recipe/session/index.ts:105](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L105) ###### Type Parameters | Type Parameter | | ------ | | `T` | ###### Parameters | Parameter | Type | | ------ | ------ | | `input` | \{ `claim`: `SessionClaim`\<`T`\>; `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.claim` | `SessionClaim`\<`T`\> | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`T`\> ##### getInvalidClaimsFromResponse() ```ts static getInvalidClaimsFromResponse(input): Promise; ``` Defined in: [recipe/session/index.ts:98](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L98) ###### Parameters | Parameter | Type | | ------ | ------ | | `input` | \{ `response`: \| `Response` \| \{ `data`: `any`; \}; `userContext`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.response` | \| `Response` \| \{ `data`: `any`; \} | | `input.userContext` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`ClaimValidationError`[]\> ##### getUserId() ```ts static getUserId(input?): Promise; ``` Defined in: [recipe/session/index.ts:44](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L44) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`string`\> ##### init() ```ts static init(config?): any; ``` Defined in: [recipe/session/index.ts:40](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L40) ###### Parameters | Parameter | Type | | ------ | ------ | | `config?` | `any` | ###### Returns `any` ##### signOut() ```ts static signOut(input?): Promise; ``` Defined in: [recipe/session/index.ts:79](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L79) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `Promise`\<`void`\> ##### validateClaims() ```ts static validateClaims(input?): ClaimValidationError[] | Promise; ``` Defined in: [recipe/session/index.ts:85](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L85) ###### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `overrideGlobalClaimValidators?`: (`globalClaimValidators`, `userContext`) => `SessionClaimValidator`[]; `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.overrideGlobalClaimValidators?` | (`globalClaimValidators`, `userContext`) => `SessionClaimValidator`[] | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | ###### Returns `ClaimValidationError`[] \| `Promise`\<`ClaimValidationError`[]\> *** ### PrimitiveArrayClaim\ Defined in: [claims/primitiveArrayClaim.ts:6](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/primitiveArrayClaim.ts#L6) #### Extends - [`SuperTokensWrapper`](index.mdx#supertokenswrapper-1)\<`T`\> #### Type Parameters | Type Parameter | | ------ | | `T` | #### Constructors ##### Constructor ```ts new PrimitiveArrayClaim(config): PrimitiveArrayClaim; ``` Defined in: [claims/primitiveArrayClaim.ts:7](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/primitiveArrayClaim.ts#L7) ###### Parameters | Parameter | Type | | ------ | ------ | | `config` | `any` | ###### Returns [`PrimitiveArrayClaim`](#primitivearrayclaim)\<`T`\> ###### Overrides ```ts PrimitiveArrayClaimWebJS.constructor ``` *** ### PrimitiveClaim\ Defined in: [claims/primitiveClaim.ts:6](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/primitiveClaim.ts#L6) #### Extends - [`SuperTokensWrapper`](index.mdx#supertokenswrapper-1)\<`T`\> #### Type Parameters | Type Parameter | | ------ | | `T` | #### Constructors ##### Constructor ```ts new PrimitiveClaim(config): PrimitiveClaim; ``` Defined in: [claims/primitiveClaim.ts:7](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/claims/primitiveClaim.ts#L7) ###### Parameters | Parameter | Type | | ------ | ------ | | `config` | `any` | ###### Returns [`PrimitiveClaim`](#primitiveclaim)\<`T`\> ###### Overrides ```ts PrimitiveClaimWebJS.constructor ``` ## Variables ### ~~addAxiosInterceptors()~~ ```ts const addAxiosInterceptors: (axiosInstance, userContext?) => void = SessionAPIWrapper.addAxiosInterceptors; ``` Defined in: [recipe/session/index.ts:127](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L127) #### Parameters | Parameter | Type | | ------ | ------ | | `axiosInstance` | `any` | | `userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `void` #### Deprecated #### Deprecated *** ### attemptRefreshingSession() ```ts const attemptRefreshingSession: () => Promise = SessionAPIWrapper.attemptRefreshingSession; ``` Defined in: [recipe/session/index.ts:122](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L122) #### Returns `Promise`\<`boolean`\> *** ### doesSessionExist() ```ts const doesSessionExist: (input?) => Promise = SessionAPIWrapper.doesSessionExist; ``` Defined in: [recipe/session/index.ts:123](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L123) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`boolean`\> *** ### getAccessToken() ```ts const getAccessToken: (input?) => Promise = SessionAPIWrapper.getAccessToken; ``` Defined in: [recipe/session/index.ts:120](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L120) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`string`\> *** ### getAccessTokenPayloadSecurely() ```ts const getAccessTokenPayloadSecurely: (input?) => Promise = SessionAPIWrapper.getAccessTokenPayloadSecurely; ``` Defined in: [recipe/session/index.ts:121](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L121) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`any`\> *** ### getClaimValue() ```ts const getClaimValue: (input) => Promise = SessionAPIWrapper.getClaimValue; ``` Defined in: [recipe/session/index.ts:131](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L131) #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `input` | \{ `claim`: `SessionClaim`\<`T`\>; `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.claim` | `SessionClaim`\<`T`\> | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`T`\> *** ### getInvalidClaimsFromResponse() ```ts const getInvalidClaimsFromResponse: (input) => Promise = SessionAPIWrapper.getInvalidClaimsFromResponse; ``` Defined in: [recipe/session/index.ts:130](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L130) #### Parameters | Parameter | Type | | ------ | ------ | | `input` | \{ `response`: \| `Response` \| \{ `data`: `any`; \}; `userContext`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.response` | \| `Response` \| \{ `data`: `any`; \} | | `input.userContext` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`ClaimValidationError`[]\> *** ### getUserId() ```ts const getUserId: (input?) => Promise = SessionAPIWrapper.getUserId; ``` Defined in: [recipe/session/index.ts:119](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L119) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`string`\> *** ### init() ```ts const init: (config?) => any = SessionAPIWrapper.init; ``` Defined in: [recipe/session/index.ts:118](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L118) #### Parameters | Parameter | Type | | ------ | ------ | | `config?` | `any` | #### Returns `any` *** ### SessionAuth ```ts const SessionAuth: any = SessionAPIWrapper.SessionAuth; ``` Defined in: [recipe/session/index.ts:117](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L117) *** ### SessionComponentsOverrideProvider ```ts const SessionComponentsOverrideProvider: any = SessionAPIWrapper.ComponentsOverrideProvider; ``` Defined in: [recipe/session/index.ts:132](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L132) *** ### SessionContext ```ts const SessionContext: any; ``` Defined in: [recipe/session/sessionContext.ts:5](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/sessionContext.ts#L5) *** ### signOut() ```ts const signOut: (input?) => Promise = SessionAPIWrapper.signOut; ``` Defined in: [recipe/session/index.ts:128](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L128) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `Promise`\<`void`\> *** ### useClaimValue() ```ts const useClaimValue: (claim) => | { loading: true; } | { doesSessionExist: boolean; loading: false; value: T; } = SessionAPIWrapper.useClaimValue; ``` Defined in: [recipe/session/index.ts:116](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L116) #### Type Parameters | Type Parameter | | ------ | | `T` | #### Parameters | Parameter | Type | | ------ | ------ | | `claim` | `SessionClaim`\<`T`\> | #### Returns \| \{ `loading`: `true`; \} \| \{ `doesSessionExist`: `boolean`; `loading`: `false`; `value`: `T`; \} *** ### useSessionContext() ```ts const useSessionContext: () => SessionContextType = SessionAPIWrapper.useSessionContext; ``` Defined in: [recipe/session/index.ts:115](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L115) #### Returns [`SessionContextType`](recipe-session-types.mdx#sessioncontexttype) *** ### validateClaims() ```ts const validateClaims: (input?) => ClaimValidationError[] | Promise = SessionAPIWrapper.validateClaims; ``` Defined in: [recipe/session/index.ts:129](https://github.com/supertokens/supertokens-auth-react/blob/b337b23722adfbe2906b193ea5fcf98f9c98c8b0/lib/ts/recipe/session/index.ts#L129) #### Parameters | Parameter | Type | | ------ | ------ | | `input?` | \{ `overrideGlobalClaimValidators?`: (`globalClaimValidators`, `userContext`) => `SessionClaimValidator`[]; `userContext?`: [`UserContext`](types.mdx#usercontext-1); \} | | `input.overrideGlobalClaimValidators?` | (`globalClaimValidators`, `userContext`) => `SessionClaimValidator`[] | | `input.userContext?` | [`UserContext`](types.mdx#usercontext-1) | #### Returns `ClaimValidationError`[] \| `Promise`\<`ClaimValidationError`[]\> ## References ### ClaimValidationError Renames and re-exports [SuperTokensWrapper](index.mdx#supertokenswrapper-1) *** ### ClaimValidationResult Renames and re-exports [SuperTokensWrapper](index.mdx#supertokenswrapper-1) *** ### InputType Re-exports [InputType](recipe-session-types.mdx#inputtype) *** ### RecipeInterface Renames and re-exports [SuperTokensWrapper](index.mdx#supertokenswrapper-1) *** ### SessionClaim Renames and re-exports [SuperTokensWrapper](index.mdx#supertokenswrapper-1) *** ### SessionClaimValidator Renames and re-exports [SuperTokensWrapper](index.mdx#supertokenswrapper-1) *** ### SessionContextType Re-exports [SessionContextType](recipe-session-types.mdx#sessioncontexttype)