startSignIn
uses sessionStorage
Send the browser to sign in as handle; it comes back to the registry's home, which finishes it (finishSignIn).
import { COMING_BACK, configure, REGISTRY_SCOPE } from "#codebase/tcmts/registry/session"; import { createAuthorizationUrl } from "@atcute/oauth-browser-client"; export async function startSignIn(handle: string): Promise<void> { await configure(); sessionStorage.setItem(COMING_BACK, location.pathname + location.search); const url = await createAuthorizationUrl({ target: { type: "account", identifier: handle.trim().replace(/^@/, "") as `${string}.${string}`, }, scope: REGISTRY_SCOPE, }); // (the library keeps what it needs in local storage: let it be written before leaving) await new Promise((r) => setTimeout(r, 200)); location.assign(url); }
uses
- tcmts.registry.session.COMING_BACK
- tcmts.registry.session.REGISTRY_SCOPE
- tcmts.registry.session.configure