Session authentication for React apps backed by gouncer's authkit.
@gopherium/react-authis the headless core: the auth API client,useSession,useLogout,sessionQueryKey, the slot-basedAuthGate,createAuthQueryClient, andisSessionRevoked.@gopherium/react-auth/adminis the user administration API client.@gopherium/react-auth/wpdsrenders the WordPress Design System UI:LoginScreen(brand prop),AccountPanel,UsersScreen,NewUserScreen, andusersNavItem. Import@gopherium/react-auth/wpds/style.cssalongside it.@gopherium/react-auth/testingis the msw harness:server,installTestEnvironment,seedSession,defaultUser, and canned handlers for the auth endpoints.
const client = createAuthQueryClient()
<QueryClientProvider client={client}>
<AuthGate loginScreen={(onLogin) => <LoginScreen brand="MyApp" onLogin={onLogin} />}>
<App />
</AuthGate>
</QueryClientProvider>reactand@tanstack/react-queryare peer dependencies; the app must own exactly one copy of each. With workspace or linked installs, add both to your bundler's dedupe list.- The client calls same-origin
/api/auth/*and/api/userspaths. In development, proxy/apito your backend so the__Host-session cookie is first-party. /wpdsneeds the@wordpress/uipeer.
Apache-2.0. Copyright © 2026 Manuel 'SirLouen' Camargo.