Reference · React

useSession()

Next release: this page describes techne-sdk/auth/react, which is not in techne-sdk 0.3.4 yet. With techne-sdk 0.3 today shows the released API.

React hooktechne-sdk/auth/react

The signed-in person's session, or null.

It is null while the session is restored, when nobody is signed in, and under a techne= provider, whose session your app holds itself. The session is what connect takes.

Returns

NameTypeWhat it is
sessionOAuthSession | nullThe atproto OAuth session. session.did is the person's DID.

Next to it also in techne-sdk/auth/react

NameTypeWhat it is
useAuthStatus()'restoring' | 'signed-in' | 'signed-out'Where sign-in stands, for a screen that would rather wait. Under a techne= provider it reads the client, and an empty did is signed out.
useSignOut()() => Promise<void>Revokes the session at its PDS. The provider goes back to the anonymous client at once. It rejects under a techne= provider.

A failed restore is signed out, and the provider's onError hears it. A session the OAuth library deletes, because its refresh failed, goes back to signed out too.

An account corner
Restore and sign out as calls

Set by TechneProvider when it restores the session on mount