Appearance
@loontail/minecraft-kit v0.8.14 / MojangSession
Type alias: MojangSession
ts
type MojangSession: {
microsoft: {
clientId: AzureClientId;
refreshToken: MicrosoftRefreshToken;
};
minecraft: {
accessToken: string;
expiresAt: number;
skins: ReadonlyArray<MojangProfileSkin>;
username: string;
uuid: PlayerUuid;
xuid: string;
};
};Combined Microsoft + Minecraft session returned by kit.auth.authorizationCode.run and kit.auth.refresh.
The fields under minecraft are everything OnlineAuth needs plus the raw /minecraft/profile payload so callers do not have to re-fetch it for skin/cape UI. The fields under microsoft are needed only to refresh the session later — persist them to durable storage (encrypted) alongside the user's profile.
Example
ts
import { toOnlineAuth, type MojangSession } from "@loontail/minecraft-kit";
const session: MojangSession = await kit.auth.authorizationCode.run({ onOpenBrowser });
await secrets.save(session.microsoft.refreshToken);
await kit.launch.compose(target, { auth: toOnlineAuth(session) });Type declaration
| Member | Type | Description |
|---|---|---|
microsoft | { | |
clientId: AzureClientId; | ||
refreshToken: MicrosoftRefreshToken; | ||
| } | - | |
microsoft.clientId | AzureClientId | Azure AD application id used to mint the session. |
microsoft.refreshToken | MicrosoftRefreshToken | Microsoft refresh token; used to obtain a fresh session without re-prompting. |
minecraft | { | |
accessToken: string; | ||
expiresAt: number; | ||
skins: ReadonlyArray<MojangProfileSkin>; | ||
username: string; | ||
uuid: PlayerUuid; | ||
xuid: string; | ||
| } | - | |
minecraft.accessToken | string | Bearer token for api.minecraftservices.com and the game itself. |
minecraft.expiresAt | number | Wall-clock ms timestamp when accessToken expires. |
minecraft.skins | ReadonlyArray<MojangProfileSkin> | Every skin slot Mojang has issued for the user (active + inactive). |
minecraft.username | string | Player display name. |
minecraft.uuid | PlayerUuid | Player UUID, dashed (e.g. f81d4fae-7dec-11d0-a765-00a0c91e6bf6). |
minecraft.xuid | string | Xbox User ID (XUID) as a numeric string. |