Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.
/ mclaunch-util-lib Public archive

Library to use Mojang's Yggdrasil authentication scheme (and more)

License

Notifications You must be signed in to change notification settings

kr5ch/mclaunch-util-lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mclaunch-util-lib

⚠️ This repository is archived and thus not maintained anymore.

Library to use Mojang's Yggdrasil authentication scheme (and more)

This library can:

  • Make request to Yggdrasil (authenticate, request tokens, invalidate them, etc.)
  • Read the launcher_profile.json file in the minecraft folder and serialize it (useful to retrieve the client token of the vanilla launcher for exemple)
  • More to come

Download

The latest version can be found in release/

Making requests to Yggdrasil

YggdrasilRequester req = new YggdrasilRequester();

try {
	YggdrasilAuthenticateRes res = req.authenticate(YggdrasilAgent.getMinecraftAgent(), "<username>", "<password>", "<client token>");
	System.out.println("Look what I got: " + res.getAccessToken());
}
catch (IOException | YggdrasilError e) {
	e.printStackTrace();
}

This will try to authenticate an user with its username and password and will return a YggdrasilAuthenticateRes object, which contains a access token, a client token, the profiles available on the account, etc.

The library implements all 5 endpoints; authenticate, refresh, validate, signout, and invalidate. More information on the endpoints and how to use all theses tokens can be found on http://wiki.vg/Authentication.

Debug mode can be enabled on all instances of YggdrasilRequester, this will log in plaintext every request/response.

YggdrasilRequester.setDebug(true);

Reading the launcher_profile.json

try {
	LauncherProfiles launcherProfiles = LauncherProfiles.getLauncherProfiles();
	System.out.println(launcherProfiles.getClientToken());
}
catch (JsonSyntaxException | IOException e) {
	e.printStackTrace();
}

Why make things complicated ?

Dependencies

About

Library to use Mojang's Yggdrasil authentication scheme (and more)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages