Skip to main content
After sign-in, the bridge keeps window.clerkJWT populated and maintains an in-memory user snapshot you can read offline.

Session State

A full snapshot of the signed-in user and active session, read from the in-memory cache hydrated from the secure session store. No network round-trip, works fully offline. Calling it on a signed-in user also restarts the JWT refresher.
Emits when signed in:
Optional fields are omitted when absent. Timestamps are ISO-8601 with fractional seconds. When signed out:
When not configured:

The JWT

window.clerkJWT holds the current session token, auto-refreshed every 50 seconds (under Clerk’s 60-second TTL). Attach it as a Bearer token.
The refresher de-duplicates writes, so watchers on window.clerkJWT don’t see spurious churn. Failed refreshes (offline) leave the last good value in place rather than nulling it. Refresher starts on configure, reconfigure, clerk://state while signed in, and any sign-in flow reaching complete. Stops on sign-out and reconfigure. When the app returns from the background, the bridge automatically refreshes the JWT (and re-syncs SSR cookies) before your code runs again, so a backgrounded app comes back with a fresh token.

Force a refresh

An on-demand JWT refresh, same source as the background refresher. Use this only when you need a guaranteed-fresh token right now.
jwt is null when there is no session. Errors emit with event: "token": not_configured, token_fetch_failed (window.clerkJWT keeps last value), unsupported_os, sdk_not_linked.

Handling 401

Force a refresh and retry once.
On the server, verify the JWT with @clerk/backend and trust only the verified sub claim. Never trust a client-reported userId. For middleware-based auth on Next.js, TanStack, and other frameworks, see Server-Side Auth.

Offline

Routes that work offline: clerk://state (in-memory cache) and window.clerkJWT reads (cached, refreshed in the background). Routes that need network: clerk://token, all sign-in flows, OAuth, clerk://signout.

Resources

NPM Package

despia-native