Chinay-Domitrix / MinecraftAuthLib

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MCAuthLib

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

Azure (REQUIRED)

You'll need an Azure account to do this step.

  1. Go to Azure App Registrations
  2. Click "New Registration" image
  3. Set the name and set the supported account type to personal only. image
  4. Click register and you should see something like this. This is your CLIENT_ID image
  5. Click client credentials image
  6. Click new client secret image
  7. Then enter the description and set the expiry to 24 months. image
  8. Then, the "Secret ID" is your CLIENT_SECRET. image (see above examples on how to use the CLIENT_ID and CLIENT_SECRET)

About


Languages

Language:Java 100.0%