Skip to content

@loontail/minecraft-kit / AuthorizationCodeRunOptions

Type Alias: AuthorizationCodeRunOptions

ts
type AuthorizationCodeRunOptions = {
  clientId?: AzureClientId;
  onOpenBrowser: (url) => void | Promise<void>;
  port?: number;
  signal?: AbortSignal;
  successHtml?: string;
};

Defined in: src/auth/options.ts:43

Options accepted by kit.auth.authorizationCode.run.

Example

ts
import type { AuthorizationCodeRunOptions } from "@loontail/minecraft-kit";

const options: AuthorizationCodeRunOptions = {
  onOpenBrowser: (url) => open(url),
  successHtml: "<h1>Signed in — return to the launcher.</h1>",
};
const session = await kit.auth.authorizationCode.run(options);

Properties

PropertyModifierTypeDescriptionDefined in
clientId?readonlyAzureClientIdAzure AD application id. When omitted, the value of process.env.MINECRAFT_KIT_MSA_CLIENT_ID is used. Throws AUTH_MISSING_CLIENT_ID if neither is set — the library cannot ship a default client id.src/auth/options.ts:49
onOpenBrowserreadonly(url) => void | Promise<void>Called exactly once with the authorize URL. The caller is expected to open this URL in the user's system browser (e.g. shell.openExternal in Electron, xdg-open / open / start in a CLI). The kit does not assume how to open browsers — that decision belongs to the host environment.src/auth/options.ts:56
port?readonlynumberLoopback port to bind. Defaults to 0 (OS picks).src/auth/options.ts:58
signal?readonlyAbortSignalAborting cancels both the loopback server and the post-MS-token pipeline.src/auth/options.ts:62
successHtml?readonlystringOptional HTML returned to the browser after a successful capture.src/auth/options.ts:60

MIT License