API reference / @jsprismarine/auth / XboxAuthProvider
Class: XboxAuthProvider
Defined in: XboxAuthProvider.ts:140
A login identity an Xbox Live account vouches for, which is what a server in online mode admits.
Minecraft services issues a chain and a multiplayer token for the provider's key. The login puts a link of the client's own in front of the chain, naming Mojang's root key as the next signer, and from 1.26.10 on carries the token beside it. NetherNet signs its WebRTC offer with the same token.
Signing in happens on first use, and asks for a device code when the cache has no account; after that the cached sign-in is reused, and the token is fetched again shortly before it expires.
Example
const auth = new XboxAuthProvider({
cacheDirectory: './auth-cache',
onDeviceCode: (code) => console.log(code.message)
});
const client = new Client({ host: 'example.com', auth });Extends
Constructors
Constructor
new XboxAuthProvider(
options?):XboxAuthProvider
Defined in: XboxAuthProvider.ts:147
Parameters
options?
XboxAuthOptions = {}
Returns
XboxAuthProvider
Overrides
KeyedAuthProvider.constructor
Properties
name
readonlyname:"xbox"='xbox'
Defined in: XboxAuthProvider.ts:141
For logs and for choosing between cached sessions.
Overrides
Methods
createLoginCredentials()
createLoginCredentials(
request):Promise<LoginCredentials>
Defined in: KeyedAuthProvider.ts:38
The chain and the client data, signed for one login.
Parameters
request
Returns
Promise<LoginCredentials>
Inherited from
KeyedAuthProvider.createLoginCredentials
getIdentity()
getIdentity():
Promise<Identity>
Defined in: XboxAuthProvider.ts:154
Signs in if nobody has yet.
Returns
Promise<Identity>
Overrides
getIdentityPrivateKey()
getIdentityPrivateKey():
Promise<string>
Defined in: KeyedAuthProvider.ts:49
The identity key's private half, PEM-encoded PKCS#8.
Returns
Promise<string>
Inherited from
KeyedAuthProvider.getIdentityPrivateKey
getIdentityPublicKey()
getIdentityPublicKey():
Promise<string>
Defined in: KeyedAuthProvider.ts:44
The identity key's public half, base64 DER.
Returns
Promise<string>
Inherited from
KeyedAuthProvider.getIdentityPublicKey
getMultiplayerToken()
getMultiplayerToken():
Promise<string>
Defined in: XboxAuthProvider.ts:159
The multiplayer token issued for this provider's key. Signs in if nobody has yet.
Returns
Promise<string>