signInWithAppPassword

tcmts.atproto.signInWithAppPassword · #wwp2hccn · function · runs anywhere

Sign in as who (a handle or DID) with an app password (#5rew5a3c), keeping the sign-in in store if one's given: no browser, for a server or CI. It signs in again by itself when its tokens can't be refreshed.

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

export async function signInWithAppPassword(
  who: string,
  password: string,
  o: { store?: SessionStore } = {},
): Promise<Session> {
  const s = await appPasswordSession(who, password);
  o.store?.keep(s.did, s);
  return keptSession(s, o.store);
}

uses

used by