Class MicrosoftAuthenticator
The microsoft authenticator for Minecraft (Xbox) account.
🏭 Constructors
constructor
new MicrosoftAuthenticator(dispatcher: Dispatcher): MicrosoftAuthenticator
Parameters
- dispatcher:
Dispatcher
Return Type
MicrosoftAuthenticator
Defined in: packages/user/microsoft.ts:52
🏷️ Properties
dispatcher private optional
dispatcher: Dispatcher
Defined 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:
string
The microsoft access token - signal:
AbortSignal
The 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:
string
The 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:
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
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:
string
Thexuid
in a DisplayClaims - uhs:
string
Theuhs
in a DisplayClaims - xstsToken:
string
The 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:
string
uhs from XBoxResponse of acquireXBoxToken - xstsToken:
string
You need to get this token from acquireXBoxToken - signal:
AbortSignal
Return Type
Promise<MinecraftAuthResponse>
Defined in: packages/user/microsoft.ts:180