Skip to content

Latest commit

 

History

18 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

MCAuth

Minecraft PHP Authentication for Mojang Yggdrasil (http://wiki.vg/Authentication) authentication scheme

Installation

composer require mattiabasone/mc-auth

Example:

Create new MCAuth Object

$MCAuth = new MCAuth\Api();

Authentication:

try {
    $account = $MCAuth->sendAuth("myemail@example.org", "mypassword");
    var_dump($account);
} catch (Exception $e) {
    echo $e->getMessage();
}

Get UUID from username

try {
    $uuid = $MCAuth->usernameToUuid("_Cyb3r");
    var_dump($uuid);
} catch (Exception $e) {
    echo $e->getMessage();
}

Get username from UUID

try {
    $username = $MCAuth->uuidToUsername("be1cac3b60f04e0dba12c77cc8e0ec21");
    var_dump($username);
} catch (Exception $e) {
    echo $e->getMessage();
}

Warning!

Mojang authentication system permits only one active session as reported in the wiki: "Only the one with the latest session ID for your account are allowed to join servers.", so you will be disconnected from the server where you are playing if you try to login via MCAuth.

About

Minecraft PHP Authentication for Mojang Yggdrasil authentication scheme

Topics

Resources

Stars

31 stars

Watchers

6 watching

Forks

Releases

Packages

Used by

Contributors

Languages