Note: I haven't fully tested this, this is a fork of Minecraft_MSAuth
Usage:
import net.badbird5907.authlib.MinecraftAuthLib;
import net.badbird5907.authlib.handlers.UserPassHandler;
import net.badbird5907.authlib.object.AuthResponse;
public class MyClass {
public static void main(String[] args) {
MinecraftAuthLib.setup("CLIENT_ID", "CLIENT_SECRET");
AuthResponse response = UserPassHandler.handle("name@email.com","verysecurepassword123");
String accessToken = response.getAccessToken();
String refreshToken = response.getRefreshToken();
String name = response.getName();
String skinURL = response.getSkinURL();
UUID uuid = response.getUuid();
}
}
Note: UserPassHandler.handle
will return null if something goes wrong in the authentication process
You'll need an Azure account to do this step.
- Go to Azure App Registrations
- Click "New Registration"
- Set the name and set the supported account type to personal only.
- Click register and you should see something like this. This is your CLIENT_ID
- Click client credentials
- Click new client secret
- Then enter the description and set the expiry to 24 months.
- Then, the "Secret ID" is your CLIENT_SECRET.
(see above examples on how to use the CLIENT_ID and CLIENT_SECRET)