Unofficial Node.js library for Mojang's HTTP APIs
Create sessions, get user info, change skins, and more with promises.
Includes the functions described on the Minecraft modern wiki, as well as several equally-important but undocumented endpoints. Every function makes a single HTTP request.
Please use GitHub Issues to submit a bug, request new examples, or report a missing feature. Pull requests welcome.
$ npm install mojang
Read the API documentation or look in test/ and test-online/ folders.
const mojang = require('mojang')
mojang.authenticate({username, password})
.then(session => mojang.getUser(session))
.then(user => console.info(user))
.catch(err => console.error(err))
In my experiments, everything works with lyo
and other bundlers. However, as of writing, the APIs used have not allowed cross-origin requests, so this library will not work from within a browser.
- mojang-api - small library for some Mojang username and profile endpoints
- yggdrasil - PrismarineJS's Mojang authentication with server joining
Set up an .envrc file and direnv
or similar to provide secrets to these tests first.
$ npx ava test-online/security.js
$ npx ava test-online/yggdrasil.js
$ npx ava test-online/security.js
Available through codecov.io, or locally.
$ npx nyc npm test
Ownership transferred from
jamen/node-mojang
.
This repository is not affiliated with Mojang.
"Minecraft" is a trademark of Mojang Synergies AB.