JSPM

  • Created
  • Published
  • Downloads 42567
  • Score
    100M100P100Q156524F
  • License MIT

A package to authenticate with xbox live and microsoft + cache tokens.

Package Exports

  • prismarine-auth

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prismarine-auth) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

prismarine-auth

NPM version Build Status Discord Try it on gitpod

Quickly and easily obtain an xbox token to authenticate with Minecraft/Mojang

Installation

npm install prismarine-auth

Usage

Parameters

  • username {String} - Username for authentication
  • cacheDirectory {String} - Where we will store your tokens
  • options {Object?}
    • [password] {string} - If passed we will do password based authentication.
    • [authTitle] {string} - Required to switch to live.com authentication and do title authentication. Needed for accounts with a date of birth under 18 years old.
  • onMsaCode {Function} - What we should do when we get the code. Useful for passing the code to another function.

View more examples

Device Code Example

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

const doAuth = async() => {
    const flow = new Authflow('i@heart.mineflayer', process.cwd(), { fetchProfile: true })
    const response = await flow.getMinecraftJavaToken()
    console.log(response)
}

doAuth()

Expected Response

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

Debugging

You can enable some debugging output using the DEBUG enviroment variable.

Linux

DEBUG="prismarine-auth" node [...]

Windows Powershell

$env:DEBUG = "prismarine-auth";node [...]

Windows CMD

set DEBUG="prismarine-auth"
node [...]

Testing

Simply run npm test or yarn test

License

MIT