aberdeener / minecraft-oauth
Provides easy layer to get a Minecraft profile from a Microsoft Live OAuth session
0.1.1
2023-04-02 18:39 UTC
Requires
- guzzlehttp/guzzle: ^7.5
- ramsey/uuid: ^3.9
- symfony/polyfill-php80: ^1.27
Requires (Dev)
- phpunit/phpunit: ^9.6
README
Provides easy layer to get a Minecraft profile (UUID, username, skins, capes) from a Microsoft Live OAuth session.
require 'vendor/autoload.php'; $client_id = '<Azure OAuth Client ID>'; $client_secret = '<Azure OAuth Client Secret>'; $redirect_uri = '<URL to this file>'; try { $profile = (new \Aberdeener\MinecraftOauth\MinecraftOauth)->fetchProfile( $client_id, $client_secret, $_GET['code'], $redirect_uri, ); } catch (\Aberdeener\MinecraftOauth\Exceptions\MinecraftOauthException $e) { echo $e->getMessage(); } echo 'Minecraft UUID: ' . $profile->uuid(); echo 'Minecraft Username: ' . $profile->username(); echo 'Minecraft Skin URL: ' . $profile->skins()[0]->url(); echo 'Minecraft Cape URL: ' . $profile->capes()[0]->url();