Appearance
@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
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
clientId? | readonly | AzureClientId | Azure 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 |
onOpenBrowser | readonly | (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? | readonly | number | Loopback port to bind. Defaults to 0 (OS picks). | src/auth/options.ts:58 |
signal? | readonly | AbortSignal | Aborting cancels both the loopback server and the post-MS-token pipeline. | src/auth/options.ts:62 |
successHtml? | readonly | string | Optional HTML returned to the browser after a successful capture. | src/auth/options.ts:60 |