Reference · React

<SignInWithTechne />

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 componenttechne-sdk/auth/react

The sign-in button. A click sends the person to sign in at their own PDS, as your app's OAuth client.

It needs a <TechneProvider clientId> above it and throws without one. While a sign-in runs the button is disabled and aria-busy, and a second click starts nothing. A sign-in that fails goes to the provider's onError and frees the button again.

Props

NameTypeWhat it is
handlestringWho signs in. The provider's handle by default. With none, sign-in starts at the techne.town PDS, which asks.
signUpbooleanCreate an account at the techne.town PDS instead.
childrenReactNodeThe label. By default it reads Sign in with Techne.
onClick(event) => voidRuns before the sign-in. Call event.preventDefault() to stop it.

Every other prop goes to the <button>, which is type="button" unless you pass another.

Around it also in techne-sdk/auth/react

NameTypeWhat it is
useSession()OAuthSession | nullThe session once someone is signed in. useSession
useAuthStatus()'restoring' | 'signed-in' | 'signed-out'Where sign-in stands.
useSignOut()() => Promise<void>Signs the person out.
Sign in, or make an account

The person leaves for their PDS and comes back to your redirect URI. The provider then restores the session.

The same sign-in as a call

The button calls signIn with the provider's clientId, platform and scope.

Calls signIn → with the provider's client options