Skip to content

Class MicrosoftAuthenticator

The microsoft authenticator for Minecraft (Xbox) account.

🏭 Constructors

constructor

ts
new MicrosoftAuthenticator(dispatcher: Dispatcher): MicrosoftAuthenticator

Parameters

  • dispatcher: Dispatcher

Return Type

  • MicrosoftAuthenticator

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

🏷️ Properties

dispatcher private optional

ts
dispatcher: Dispatcher

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

🔧 Methods

acquireXBoxToken

ts
acquireXBoxToken(oauthAccessToken: string, signal: AbortSignal): Promise<Object>

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<Object>

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

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:58

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 Token
  • relyingParty: "rp://api.minecraftservices.com/" | "http://xboxlive.com"
  • signal: AbortSignal

Return Type

  • Promise<XBoxResponse>

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

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:127

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:180