Package to authenticate with minecraft using traditional yggdrasil, new microsoft authentication and non-premium.
npm install minecraft-authMobile and desktop applications type
additionalInfo: string
shell
npm i --save minecraft-auth
`
Importing:
`javascript
import * as minecraftAuth from "./src/index";
//or
const minecraftAuth = require("./src/index.ts");
`
$3
* Microsoft Authentication (public client, valid for 24h):
`javascript
const MicrosoftAuth = minecraftAuth.MicrosoftAuth;
let account = new minecraftAuth.MicrosoftAccount();
MicrosoftAuth.setup({appID:"747bf062-ab9c-4690-842d-a77d18d4cf82"}); //https://github.com/dommilosz/minecraft-auth/wiki/How-to-setup-Microsoft-Auth
let code = await MicrosoftAuth.listenForCode();
if(code !== undefined){
await account.authFlow(code);
}
`
* Microsoft Authentication (don't have specified lifetimes):
`javascript
const MicrosoftAuth = minecraftAuth.MicrosoftAuth;
let account = new minecraftAuth.MicrosoftAccount();
MicrosoftAuth.setup({appID:"YOUR APP ID", appSecret:"YOUR APP SECRET"}); //https://github.com/dommilosz/minecraft-auth/wiki/How-to-setup-Microsoft-Auth
let code = await MicrosoftAuth.listenForCode();
if(code !== undefined){
await account.authFlow(code);
}
`
* Mojang Authentication (obsolete due to migration):
`javascript
let account = new minecraftAuth.MojangAccount();
await account.Login("email","password");
`
* Cracked Authentication:
`javascript
let account = new minecraftAuth.CrackedAccount("username");
`
$3
`javascript
//any type of authentication eg. 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.
`
$3
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