Skip to content

@loontail/minecraft-kit v0.8.14 / AuthorizationCodeRunOptions

Type alias: AuthorizationCodeRunOptions

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

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);

Type declaration

MemberTypeDescription
clientIdAzureClientIdAzure 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.
onOpenBrowser(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.

portnumberLoopback port to bind. Defaults to 0 (OS picks).
signalAbortSignalAborting cancels both the loopback server and the post-MS-token pipeline.
successHtmlstringOptional HTML returned to the browser after a successful capture.

Source

src/auth/options.ts:43

MIT License