Skip to main content
Your app never handles passwords or OAuth itself. The platform signs the user in, and useBridgeAuth makes the result available to your code and to every API call the SDK makes.

useBridgeAuth

Call it once, near the root of your app.
boolean
true once the hook knows whether there is a user. Wait for it before calling authenticated endpoints, or the first requests go out without credentials and fail with 401.
string | null
Non-null when a user is signed in. Treat it as a flag; the SDK attaches credentials to requests for you.
{ sub?, name?, email?, picture?, username? } | null
Basic identity of the signed-in user, available without a network round trip.

How it resolves

Sign in and sign out

Never build the auth URLs yourself; take them from the SDK.
string
Where to send the user after logout. Defaults to the current origin.
boolean
default:"false"
End every cskn session on this device, not just this app’s. Adds session=all to the link.
logoutUrl(options) returns the same link without navigating. Use it when something else has to follow the link, for example a confirmation dialog. @cskn/ui ships one: LogoutConfirm.

Lower-level API

The hook is built from functions you can use outside React: