Socket
Socket
Sign inDemoInstall

yggdrasil

Package Overview
Dependencies
8
Maintainers
3
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    yggdrasil

Mojang authentication (Yggdrasil) client


Version published
Maintainers
3
Install size
618 kB
Created

Changelog

Source

1.7.0

  • Add new endpoint to invalidate all accessTokens using current valid accessToken and clientToken
  • Fixed "call" function throwing an empty error message

Readme

Source

yggdrasil

NPM version Build Status Discord Gitter Irc

Try it on gitpod

A Node.js client for doing requests to yggdrasil, the Mojang authentication system, used for Minecraft and Scrolls.

Usage

$ npm install yggdrasil

Client

//init
const ygg = require('yggdrasil')({
  //Optional settings object
  host: 'https://authserver.mojang.com' //Optional custom host. No trailing slash.
});

//Authenticate a user
ygg.auth({
  token: '', //Optional. Client token.
  agent: '', //Agent name. Defaults to 'Minecraft'
  version: 1, //Agent version. Defaults to 1
  user: '', //Username
  pass: '', //Password
  requestUser: false //Optional. Request the user object to be included in response
}).then(
  (response)=>{},
  (error)=>{}
);

//Refresh an accessToken
ygg.refresh(oldAccessToken, clientToken, true).then(
  ({accessToken, clientToken, user?})=>{},
  (error)=>{}
);
// Note that requestUser is an optional parameter. If set to true, it requests the user object from Mojang's authentication servers as well.

//Validate an accessToken
ygg.validate(token).then(
  (response)=>{},
  (error)=>{}
);

//Invalidate all accessTokens using a current valid accessToken and clientToken.
ygg.invalidate(accessToken, clientToken).then(
  (response)=>{},
  (error)=>{}
);

//Invalidate all accessTokens
ygg.signout(username, password).then(
  (response)=>{},
  (error)=>{}
);

Server

const yggserver = require('yggdrasil').server({
  //Optional settings object
  host: 'https://authserver.mojang.com' //Optional custom host. No trailing slash.
});

//Join a server (clientside)
yggserver.join(token, profile, serverid, sharedsecret, serverkey).then(
  (response)=>{},
  (error)=>{}
);

//Join a server (serverside)
yggserver.hasJoined(username, serverid, sharedsecret, serverkey).then(
  (clientInfo)=>{},
  (error)=>{}
);

Proxy Support

const ProxyAgent = require('proxy-agent');

const ygg = require('yggdrasil')({
  //Any type of HTTP Agent 
  agent: new ProxyAgent('https://example.com:8080')
});

Further Reading

Keywords

FAQs

Last updated on 27 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc