
Facilitates Minecraft login using Microsoft credentials by exchanging Microsoft access tokens for Minecraft ones. Offers quick login and Xbox Live intermediary token retrieval options, ensuring account security awareness.
Simplifies the process of logging into Minecraft services on behalf of a Microsoft user. In order to use this library, you will need to create an app that interfaces with the Microsoft Identity Platform. The easiest way is using an implementation of the Microsoft Authentication Library (MSAL).
Once your app is set up, request an access token from the user (that's what you'll need to use this library). Be sure to ask for the XboxLive.signin scope! It's required for
logging in to Minecraft.
Firstly, Minecraft access tokens can be dangerous! Tokens grant an application full permissions to a user's account, meaning they can...
I strongly recommend you provide a similar disclaimer to users logging into your own app, both for their security and to raise awareness of the dangers of Minecraft authentication with third-party apps.
Secondly, this is NOT a Minecraft API library. Its only function is exchanging Microsoft access tokens for Minecraft ones, which can be used to perform actions on behalf of a Minecraft account. To interface with the rest of Minecraft's online services you'll need a separate library of your choice.
dependencies {
implementation("me.nullicorn:ms-to-mca:0.0.1")
// ...your other dependencies...
}dependencies {
implementation 'me.nullicorn:ms-to-mca:0.0.1'
// ...your other dependencies...
}<dependencies>
<dependency>
<groupId>me.nullicorn</groupId>
<artifactId>ms-to-mca</artifactId>
<version>0.0.1</version>
</dependency>
<!-- ...your other dependencies... -->
</dependencies>This process takes you straight from Microsoft --> Minecraft token, without dealing with Xbox by hand.
// Authentication with Minecraft is done via the MinecraftAuth class.
val minecraft = MinecraftAuth()
// Exchanges your Microsoft access token for a Minecraft access token.
val token: MinecraftToken = minecraft.login("<microsoft access token>")A MinecraftToken has four attributes:
type (String) The authentication scheme to use the token with.
Authorization header.Bearer, the header's value would look like Bearer <VALUE>value (String) The actual value of the token.
user (String) The UUID of the Minecraft account that the token is for.
duration (Int) The number of seconds that the token will last for after its creation.This process is slightly more involved, but lets you access the two intermediary tokens for Xbox Live, if you need them for whatever reason.
If you already have an Xbox Live token for some reason, this also allows you to use it directly for login.
// Xbox Live services are interacted with using the XboxLiveAuth class.
val xbox = XboxLiveAuth()
// The first step is to exchange your Microsoft access token for an Xbox Live "user" token.
val userToken = xbox.getUserToken("<microsoft access token>")
// The next step is to exchange your user token for an Xbox Live "service" token. This can also be
// referred to as an "XSTS token".
val serviceToken = xbox.getServiceToken(userToken.value)
// Now, you can get the same MinecraftToken object as in the "Quick Login".
val minecraft = MinecraftAuth()
val minecraftToken = minecraft.login(serviceToken)Simplifies the process of logging into Minecraft services on behalf of a Microsoft user. In order to use this library, you will need to create an app that interfaces with the Microsoft Identity Platform. The easiest way is using an implementation of the Microsoft Authentication Library (MSAL).
Once your app is set up, request an access token from the user (that's what you'll need to use this library). Be sure to ask for the XboxLive.signin scope! It's required for
logging in to Minecraft.
Firstly, Minecraft access tokens can be dangerous! Tokens grant an application full permissions to a user's account, meaning they can...
I strongly recommend you provide a similar disclaimer to users logging into your own app, both for their security and to raise awareness of the dangers of Minecraft authentication with third-party apps.
Secondly, this is NOT a Minecraft API library. Its only function is exchanging Microsoft access tokens for Minecraft ones, which can be used to perform actions on behalf of a Minecraft account. To interface with the rest of Minecraft's online services you'll need a separate library of your choice.
dependencies {
implementation("me.nullicorn:ms-to-mca:0.0.1")
// ...your other dependencies...
}dependencies {
implementation 'me.nullicorn:ms-to-mca:0.0.1'
// ...your other dependencies...
}<dependencies>
<dependency>
<groupId>me.nullicorn</groupId>
<artifactId>ms-to-mca</artifactId>
<version>0.0.1</version>
</dependency>
<!-- ...your other dependencies... -->
</dependencies>This process takes you straight from Microsoft --> Minecraft token, without dealing with Xbox by hand.
// Authentication with Minecraft is done via the MinecraftAuth class.
val minecraft = MinecraftAuth()
// Exchanges your Microsoft access token for a Minecraft access token.
val token: MinecraftToken = minecraft.login("<microsoft access token>")A MinecraftToken has four attributes:
type (String) The authentication scheme to use the token with.
Authorization header.Bearer, the header's value would look like Bearer <VALUE>value (String) The actual value of the token.
user (String) The UUID of the Minecraft account that the token is for.
duration (Int) The number of seconds that the token will last for after its creation.This process is slightly more involved, but lets you access the two intermediary tokens for Xbox Live, if you need them for whatever reason.
If you already have an Xbox Live token for some reason, this also allows you to use it directly for login.
// Xbox Live services are interacted with using the XboxLiveAuth class.
val xbox = XboxLiveAuth()
// The first step is to exchange your Microsoft access token for an Xbox Live "user" token.
val userToken = xbox.getUserToken("<microsoft access token>")
// The next step is to exchange your user token for an Xbox Live "service" token. This can also be
// referred to as an "XSTS token".
val serviceToken = xbox.getServiceToken(userToken.value)
// Now, you can get the same MinecraftToken object as in the "Quick Login".
val minecraft = MinecraftAuth()
val minecraftToken = minecraft.login(serviceToken)