signInLoopback

tcmts.atproto.signInLoopback · #qda2mhxh · function · runs anywhere

Sign in as who (a handle or DID) in the browser on this machine, for scope (#pbj5mtry), keeping the sign-in in store if one's given: for a command-line program, or a script.

import { keptSession, loopbackOAuth } from "#codebase/tcmts/atproto";
import type { Session, SessionStore } from "#codebase/tcmts/atproto";

export async function signInLoopback(
  who: string,
  o: { scope: string; store?: SessionStore; tell?: (line: string) => void },
): Promise<Session> {
  const s = await loopbackOAuth(who, o.scope, o.tell);
  o.store?.keep(s.did, s);
  return keptSession(s, o.store);
}

uses

used by