Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattiabasone/mcauth
Minecraft PHP Authentication for Mojang Yggdrasil authentication scheme
https://github.com/mattiabasone/mcauth
minecraft minecraft-php-authentication mojang-authentication php
Last synced: 1 day ago
JSON representation
Minecraft PHP Authentication for Mojang Yggdrasil authentication scheme
- Host: GitHub
- URL: https://github.com/mattiabasone/mcauth
- Owner: mattiabasone
- License: other
- Created: 2013-09-28T23:38:25.000Z (over 11 years ago)
- Default Branch: composer
- Last Pushed: 2017-03-19T20:36:38.000Z (almost 8 years ago)
- Last Synced: 2024-11-25T16:26:57.875Z (3 months ago)
- Topics: minecraft, minecraft-php-authentication, mojang-authentication, php
- Language: PHP
- Homepage:
- Size: 16.6 KB
- Stars: 31
- Watchers: 7
- Forks: 8
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MCAuth
Minecraft PHP Authentication for Mojang Yggdrasil (http://wiki.vg/Authentication) authentication scheme
### Installation
```shell
composer require mattiabasone/mc-auth
```### Example:
Create new MCAuth Object
```php
$MCAuth = new MCAuth\Api();
```Authentication:
```php
try {
$account = $MCAuth->sendAuth("[email protected]", "mypassword");
var_dump($account);
} catch (Exception $e) {
echo $e->getMessage();
}
```Get UUID from username
```php
try {
$uuid = $MCAuth->usernameToUuid("_Cyb3r");
var_dump($uuid);
} catch (Exception $e) {
echo $e->getMessage();
}
```Get username from UUID
```php
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.