Auth Hooks
Authentication state and session management hooks
Hooks for authentication flows and session management.
Package
@tetherto/mdk-react-adapter
Hooks
useAuthToken
Reads ?authToken=… from window.location.search, persists it into the headless authStore, and strips the parameter from the URL via history.replaceState so the token never lingers in the address bar.
() => string | nulluseCurrentUserEmail
Fetches /auth/userinfo and returns the current user's email. Used by useLiveActions to partition actions into "mine vs others".
() => string | undefineduseTokenPolling
Periodically calls POST /auth/token to refresh the bearer token. On a 401 or 500 response the session is cleared (authStore.reset()) and onSessionEnded fires so the host app can redirect to its sign-in page.
(options: UseTokenPollingOptions = {}) => void