prismarine-auth

Microsoft/Xbox Live authentication

Showing:

Popularity

Downloads/wk

115

GitHub Stars

5

Maintenance

Last Commit

1mo ago

Contributors

3

Package

Dependencies

6

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

prismarine-auth

NPM version Build Status Discord Try it on gitpod

Quickly and easily obtain auth tokens to authenticate with Microsoft/Xbox/Minecraft/Mojang

Installation

npm install prismarine-auth

Usage

Authflow

Parameters

  • username? {String} - Username for authentication
  • cacheDirectory? {String} - Where we will store your tokens (optional)
  • options {Object?}
    • [password] {string} - If passed we will do password based authentication.
    • [authTitle] {string} - See the API.md
  • onMsaCode {Function} - (For device code auth) What we should do when we get the code. Useful for passing the code to another function.

View more examples

Examples

getMsaToken

const { Authflow, Titles } = require('prismarine-auth')

const userIdentifier = 'any unique identifier'
const cacheDir = './' // You can leave this as undefined unless you want to specify a caching directory
const options = {}
const flow = new Authflow(userIdentifier, cacheDir, options)
// Get a auth token, then log it
flow.getMsaToken().then(console.log)

getXboxToken

See docs/API.md

getMinecraftJavaToken

const { Authflow, Titles } = require('prismarine-auth')

const userIdentifier = 'any unique identifier'
const cacheDir = './' // You can leave this as undefined unless you want to specify a caching directory
const options = { authTitle: Titles.MinecraftJava }
const flow = new Authflow(userIdentifier, cacheDir, options)
// Get a Minecraft Java Edition auth token, then log it
flow.getMinecraftJavaToken().then(console.log)

Expected Response

{
    "token": "ey....................",
    "entitlements": {},
    "profile": {
        "id": "b945b6ed99b548675309473a69661b9a",
        "name": "Usname",
        "skins": [ [Object] ],
        "capes": []
    }
}

getMinecraftBedrockToken

See docs/API.md and example.

API

See docs/API.md

Debugging

You can enable some debugging output using the DEBUG enviroment variable. Through node.js, you can add process.env.DEBUG = 'prismarine-auth' at the top of your code.

Testing

Simply run npm test or yarn test

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100