Class MicrosoftAuthenticator
The microsoft authenticator for Minecraft (Xbox) account.
🏭 Constructors
constructor
new MicrosoftAuthenticator(dispatcher: Dispatcher): MicrosoftAuthenticatorParameters
- dispatcher:
Dispatcher
Return Type
MicrosoftAuthenticator
Defined in: packages/user/microsoft.ts:52
🏷️ Properties
dispatcher
dispatcher: DispatcherDefined in: packages/user/microsoft.ts:52
🔧 Methods
acquireXBoxToken
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
- authenticateXboxLive
- authorizeXboxLive to
rp://api.minecraftservices.com/ - authorizeXboxLive to
http://xboxlive.com - getXboxGameProfile
You can call them individually if you want a more detailed control.
Parameters
- oauthAccessToken:
stringThe microsoft access token - signal:
AbortSignalThe abort signal
Return Type
Promise<Object>
Defined in: packages/user/microsoft.ts:164
authenticateXboxLive
authenticateXboxLive(oauthAccessToken: string, signal: AbortSignal): Promise<XBoxResponse>Authenticate with xbox live by ms oauth access token
Parameters
- oauthAccessToken:
stringThe oauth access token - signal:
AbortSignal
Return Type
Promise<XBoxResponse>
Defined in: packages/user/microsoft.ts:58
authorizeXboxLive
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:
stringThe Token - relyingParty:
"rp://api.minecraftservices.com/" | "http://xboxlive.com" - signal:
AbortSignal
Return Type
Promise<XBoxResponse>
Defined in: packages/user/microsoft.ts:90
getXboxGameProfile
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
- xuid:
stringThexuidin a DisplayClaims - uhs:
stringTheuhsin a DisplayClaims - xstsToken:
stringThe Token - signal:
AbortSignal
Return Type
Promise<XBoxGameProfileResponse>
Defined in: packages/user/microsoft.ts:127
loginMinecraftWithXBox
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
- uhs:
stringuhs from XBoxResponse of acquireXBoxToken - xstsToken:
stringYou need to get this token from acquireXBoxToken - signal:
AbortSignal
Return Type
Promise<MinecraftAuthResponse>
Defined in: packages/user/microsoft.ts:180