Skip to content

FrameworkAuthAdapter

Defined in: packages/react/src/config/useFrameworkComponents.ts:144

App-provided sign-in/out actions for AdminTopNav’s control.

FrameworkComponents.auth

signInHref: (redirectTo) => string

Defined in: packages/react/src/config/useFrameworkComponents.ts:153

Builds the sign-in URL for a signed-out visitor, given the current admin URL to return to after signing in (e.g. appended as a redirectTo query param, matching the convention the project’s own sign-in-gate middleware already uses).

string

The current admin URL (path + query), to return to after sign-in.

string

The sign-in route’s URL, e.g. /auth/sign-in?redirectTo=%2Fadmin%2Fposts.


signOut: () => Promise<void>

Defined in: packages/react/src/config/useFrameworkComponents.ts:170

Signs the current session out AND triggers whatever full, server-aware refresh the framework needs (Next.js: signOut() then router.refresh()) so the admin panel’s own server-resolved auth state (VexAuthProvider, seeded by NextAdminPage) and any route guard re-evaluate against the now-signed-out session on return — landing on the sign-in page if anonymous admin access isn’t configured, or the admin panel’s own anonymous view if it is, exactly like a fresh unauthenticated request would. AdminTopNav only calls this once and shows a pending state until it settles — the adapter owns the whole sequence, not just the Better Auth call.

Promise<void>

A promise that resolves once the ENTIRE sign-out sequence (not just the auth-client call) completes — AdminTopNav’s own pending state matches its lifetime. Should resolve even on failure (matching SessionButton.tsx’s own “a stale client cache after a failed sign-out is worse than a redundant refresh” reasoning) rather than rejecting and leaving the control stuck pending.