Skip to content

bedrock: Return new Bearer-like minecraft session token in .getMinecraftBedrockToken()#160

Merged
extremeheat merged 1 commit intoPrismarineJS:masterfrom
extremeheat:bedrock-tokens
Mar 29, 2026
Merged

bedrock: Return new Bearer-like minecraft session token in .getMinecraftBedrockToken()#160
extremeheat merged 1 commit intoPrismarineJS:masterfrom
extremeheat:bedrock-tokens

Conversation

@extremeheat
Copy link
Copy Markdown
Member

Breaking - Adds a new token field instead of singularly returning the chain in getMinecraftBedrockToken().

-### getMinecraftBedrockToken (publicKey: KeyObject): Promise<string[]>
+### getMinecraftBedrockToken (publicKey: KeyObject): Promise<MinecraftBedrockLogin>
+
+  export interface MinecraftBedrockLogin {
+    chain: string[]
+    token: string
+  }

They’re both JWTs, but they serve different roles.

chain: certificate/identity proof, array of JWTs
token: multiplayer auth JWT, single JWT, key-bound via cpk (Bearer token like)

…aftBedrockToken()

Adds a new `token` field on top of `chain`.

They’re both JWTs, but they serve different roles.

* chain

This is the Bedrock identity certificate chain.
It is an array of JWTs, not a single token.
It exists to prove player identity and establish trust from Mojang/Microsoft down to the client’s key.
In practice, it carries identity-style claims like extraData, identityPublicKey, etc.
The server walks the chain and verifies signatures step by step.
* token

This is the separate Bedrock multiplayer login token introduced/required by the newer flow.
It is a single JWT.
It is closer in purpose to an auth/session token than to the old cert chain, but it is still a JWT, not an opaque bearer string.
From the investigation, it includes claims like:
cpk: client public key
xid: Xbox user id
xname: gamertag
iss, aud
The important bit is that it is bound to the client keypair via cpk.
So the mental model is:

chain = “who are you, and what key is your Bedrock identity rooted in?”
token = “are you authorized for multiplayer login right now, for this client key?”
Why both now:

Older flow mostly relied on the cert chain.
Newer 1.26.10-style login appears to require both:
Certificate: the chain
Token: the multiplayer token
So token is not like the Minecraft Services mcToken used for web APIs.
That mcToken is more like a conventional API bearer token.
This Bedrock login token is still JWT-based, but specifically for Bedrock multiplayer login/auth and cryptographically tied to the client key.

Short version:

chain: certificate/identity proof, array of JWTs
token: multiplayer auth JWT, single JWT, key-bound via cpk
@extremeheat extremeheat marked this pull request as ready for review March 29, 2026 20:18
@extremeheat extremeheat merged commit c14f3f1 into PrismarineJS:master Mar 29, 2026
3 checks passed
@extremeheat
Copy link
Copy Markdown
Member Author

/makerelease major

@rom1504bot rom1504bot mentioned this pull request Mar 29, 2026
@extremeheat
Copy link
Copy Markdown
Member Author

/makerelease 3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant