Reference · SDK

signIn(options?)

functiontechne-sdk/authbrowser

Sends the person to sign in at their own PDS, as your app's OAuth client. They come back to your redirect URI; restore then answers the session.

Your app is its own atproto OAuth client, like Sign in with Google. The person consents to your app and the scopes it asks for. They do not consent to the platform.

Options

NameTypeWhat it is
clientIdstringThe https URL of your client metadata. Left out, or on localhost, the loopback client.
handlestringWho. A bare name (yourname) is yourname.techne.town; a full handle, a DID or a PDS URL goes as given. None starts at techne.town, which asks.
signUpbooleanCreate an account at techne.town (its create-account screen).
scopestring | string[]The scopes to ask for. The defaults are listed below.
typesstring[]The types your app writes in their repo, for the default scopes: one repo: scope each. Ignored with scope.
everything'read' | 'write'Ask for everything the person can reach, for the default scopes: 'read' adds authRead, 'write' adds authRead and authWrite. The consent page shows a large warning. Ignored with scope.
publishbooleanAsk to publish community types, for the default scopes: adds registry.publishType. Ignored with scope. From techne-sdk 0.3.1.
platformstringThe platform's service DID, the scopes' audience. Default TECHNE_PLATFORM_DID, did:web:techne.computer.
pdsstringThe home PDS: where handles resolve, and where a sign-in with no handle and every sign-up start. Default https://pds.techne.town.
plcUrlstringThe PLC directory a did:plc resolves at. Default plc.directory.
handleDomainstringThe handle domain a bare name signs in under. Default techne.town.
statestringHanded back by the redirect.

Answers Promise<void>, and the page navigates away.

Around it also in techne-sdk/auth

NameTypeWhat it is
restore({ clientId })OAuthSession | nullFinishes a sign-in on the redirect back, else restores the kept session. null when nobody is signed in. Rejects when the person said no.
signUp({ clientId })Promise<void>signIn with signUp: true.
signOut({ clientId, session })Promise<void>Revokes the session at its PDS and forgets it here.
clientMetadata({ clientId, clientName })objectThe document to serve at clientId. It describes a public browser client with DPoP-bound tokens.

The default scopes are least privilege: atproto; include:pub.techne.draft.authPermissioned at the platform (the permissioned.* calls); your app's own private space, space:pub.techne.draft.space.private?skey=<appKey>; rpc: scopes for query.listRecords, countRecords and getRecords and for registry.getType and listTypes; and for each of types, a repo: scope, with sync.indexRecord so put can hint what it wrote. everything: 'read' adds authRead, everything: 'write' authRead and authWrite; publish: true (0.3.1) adds registry.publishType. Pass the same options to clientMetadata: the PDS refuses a request beyond what the metadata declares. Permissions says what each scope reaches.

Sign in, then connect
Served at your clientId
The same in React

The provider runs restore on mount and connects for you. TechneProvider

Then connect(session, TECHNE_PLATFORM_DID) →