UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

28 lines 1.49 kB
import { TwoFactorAuthErrorResponse } from '@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse'; import { ApplicationSessionContextType } from './ApplicationSessionContext'; export type UseSessionManagerOptions = { /** The realm that an unauthenticated user should be signed in to. Defaults to "0", the public Synapse realm */ defaultRealm?: string; maxAge?: number; /** Called if the user is not authenticated when the session is initialized. Can be used to trigger an error if authentication is expected. */ onMissingExpectedAuthentication?: () => void; onTwoFactorAuthResetThroughSSO?: (twoFactorAuthSSOError: TwoFactorAuthErrorResponse, twoFaResetToken: string) => void; }; export type UseSessionManagerReturn = { sessionContext: ApplicationSessionContextType; token: string | undefined; }; /** * Hook that manages the Synapse user session lifecycle. * * Handles token acquisition, validation, SSO detection, and provides * all values needed for the ApplicationSessionContext and SynapseContext. * * This is a React wrapper around {@link SynapseSessionManager}, which contains * the framework-agnostic session logic. Session state is synchronized via * `useSyncExternalStore`. * * Must be called within a react-router Router and a react-query QueryClientProvider. */ export declare function useSessionManager(options?: UseSessionManagerOptions): UseSessionManagerReturn; //# sourceMappingURL=useSessionManager.d.ts.map