Skip to content
Last Updated
Mar 28, 2025, 03:08

Class MicrosoftAuthenticator ​

The microsoft authenticator for Minecraft (Xbox) account.

🏭 Constructors ​

constructor ​

ts
MicrosoftAuthenticator(options: MicrosoftAuthenticatorOptions): MicrosoftAuthenticator

Parameters ​

  • options: MicrosoftAuthenticatorOptions

Return Type ​

  • MicrosoftAuthenticator

Defined in: packages/user/microsoft.ts:57

🏷️ Properties ​

fetch ​

ts
fetch: (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>

Defined in: packages/user/microsoft.ts:55

🔧 Methods ​

acquireXBoxToken ​

ts
acquireXBoxToken(oauthAccessToken: string, signal: AbortSignal): Promise<{ liveXstsResponse: XBoxResponse; minecraftXstsResponse: XBoxResponse }>

Acquire both Minecraft and xbox token and xbox game profile. You can use the xbox token to login Minecraft by loginMinecraftWithXBox.

This method is the composition of calling

You can call them individually if you want a more detailed control.

Parameters ​

  • oauthAccessToken: string The microsoft access token
  • signal: AbortSignal The abort signal

Return Type ​

  • Promise<{ liveXstsResponse: XBoxResponse; minecraftXstsResponse: XBoxResponse }>

Defined in: packages/user/microsoft.ts:168

authenticateXboxLive ​

ts
authenticateXboxLive(oauthAccessToken: string, signal: AbortSignal): Promise<XBoxResponse>

Authenticate with xbox live by ms oauth access token

Parameters ​

  • oauthAccessToken: string The oauth access token
  • signal: AbortSignal

Return Type ​

  • Promise<XBoxResponse>

Defined in: packages/user/microsoft.ts:65

authorizeXboxLive ​

ts
authorizeXboxLive(xblResponseToken: string, relyingParty: "rp://api.minecraftservices.com/" | "http://xboxlive.com"= 'rp://api.minecraftservices.com/', signal: AbortSignal): Promise<XBoxResponse>

Authorize the xbox live. It will get the xsts token in response.

Parameters ​

  • xblResponseToken: string The XBoxResponse.Token
  • relyingParty: "rp://api.minecraftservices.com/" | "http://xboxlive.com"
  • signal: AbortSignal

Return Type ​

  • Promise<XBoxResponse>

Defined in: packages/user/microsoft.ts:96

getXboxGameProfile ​

ts
getXboxGameProfile(xuid: string, uhs: string, xstsToken: string, signal: AbortSignal): Promise<XBoxGameProfileResponse>

Get xbox user profile, including username and avatar.

You can find the parameters from the XBoxResponse.

Parameters ​

Return Type ​

  • Promise<XBoxGameProfileResponse>

Defined in: packages/user/microsoft.ts:132

loginMinecraftWithXBox ​

ts
loginMinecraftWithXBox(uhs: string, xstsToken: string, signal: AbortSignal): Promise<MinecraftAuthResponse>

This will return the response with Minecraft access token!

This access token allows us to launch the game, but, we haven't actually checked if the account owns the game. Everything until here works with a normal Microsoft account!

Parameters ​

Return Type ​

  • Promise<MinecraftAuthResponse>

Defined in: packages/user/microsoft.ts:184