MDK Logo

Auth

Authentication state and session management hooks

Hooks for authentication flows and session management.

Package

@tetherto/mdk-react-adapter

Hooks

@tetherto/mdk-react-adapter

Import the public APIs on this page from @tetherto/mdk-react-adapter.

useAuthToken

Adopts whatever session the environment is offering, then returns the current token so callers can react to it (e.g. redirect once signed in).

() => string | null

useCurrentUserEmail

Fetches /auth/userinfo and returns the current user's email. Used by useLiveActions to partition actions into "mine vs others".

() => string | undefined

useTokenPolling

Keeps the session alive by calling the active AuthProvider's refresh on an interval. When a refresh reports the session ended, the provider signs out and onSessionEnded fires so the host app can redirect to its sign-in page.

(options: UseTokenPollingOptions = {}) => void

On this page