Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

minecraft-auth

Package Overview
Dependencies
5
Maintainers
1
Versions
33
Issues
File Explorer

Advanced tools

minecraft-auth

Package to authenticate with minecraft using traditional yggdrasil, new microsoft authentication and non-premium.

    1.0.32latest

Version published
Maintainers
1
Yearly downloads
3,024
decreased by-48.72%

Weekly downloads

Readme

Source

Minecraft-auth package

npm bundle size GitHub package.json version GitHub top language npm

Minecraft-auth is a package to authenticate and get minecraft access tokens.

Authentication Types:

  • Mojang Authentication - standard mojang authentication using username and password
  • Microsoft Authentication - new Microsoft oauth authentication to login to new accounts / migrated to microsoft
  • Cracked Authentication - non premium offline mode authentication. Requires only username.

Mojang API:

Package contains MojangApi class which can be used to fetch other users skins, uuids, check server status and more.

Deprecation Notice:

Usage of lowercase classes like mojangAccount should be converted to use uppercase equivalents like MojangAccount. Usage of lowercase classes may be removed in the future. Currently, it only shows warning about the deprecation.

Error handling:

All authentication errors are thrown by using AuthenticationError or OwnershipError classes they all extend Error class. AuthenticationError also contains additionalInfo: string

Authentication Examples:

  • Mojang Authentication:
var minecraftAuth = require("minecraft-auth") let account = new minecraftAuth.MojangAccount(); await account.Login("email","password");
  • Microsoft Authentication:
var minecraftAuth = require("minecraft-auth") let account = new minecraftAuth.MicrosoftAccount(); let appID = "app id"; let appSecret = "app secret"; let redirectURL = "http://localhost/auth"; minecraftAuth.MicrosoftAuth.setup(appID, appSecret, redirectURL); console.log(minecraftAuth.MicrosoftAuth.createUrl()); let code = await MicrosoftAuth.listenForCode(8080); if(code !== undefined){ await account.authFlow(code); }
  • Cracked Authentication:
var minecraftAuth = require("minecraft-auth") let account = new minecraftAuth.CrackedAccount("username");

Usage example

await authenticate(); //function from above examples console.log(account.accessToken); await account.getProfile(); console.log(account.username); //Username of the account console.log(account.uuid); //UUID of the account (without dashes) console.log(account.ownership); //Does account even have minecraft console.log(account.profile) //User profile - skins, capes, uuid, username console.log(account.profile.skins[0].url) //URL of the 1st skin.

accountsStorage:

AccountsStorage is a storage for your accounts.

Adding accounts:

You can add new account with AccountsStorage::addAccount(account)

Removing accounts:

You can remove account with AccountsStorage::removeAccount(account)

Getting accounts:

You can get accounts with:

  • getAccount(index)
  • getAccountByName(name)
  • getAccountByUUID(uuid)
Saving/Reading accounts:
  • serialize converts storage to JSON string to save in file
  • deserialize converts string to AccountStorage object

Keywords

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc