Skip to content

πŸ”“ Nodejs package that interacts with the minecraft plugin "Nlogin" with the same can assemble web login system

License

Notifications You must be signed in to change notification settings

sebastianjnuwu/nlogin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

About nLogin

logo
License

"nLogin is an authentication system used by the biggest servers in Brazil now in javascript!"

  • get and set email/discord/ip
  • login verification
  • get uuid

Warning: The supported hashes are: BCRYPT2Y, BCRYPT2A, SHA256; we recommend using SHA256.

plugin settings

β€’ See below the Nlogin settings in the plugin config.yml, remember to configure MySQL.

  hashing:
    algorithm: "SHA256" # very important

settings using nodejs

β€’ download the dependencies:

npm i sequelize nlogin-js mysql2

main.js:

import Sequelize from 'sequelize';
import nlogin from 'nlogin-js';

const sequelize = new Sequelize('nLogin', 'root', '', {
  dialect: 'mysql',
  host: '0.0.0.0',
  port: 3006,
  logging: false,
  define: {
    timestamps: false,
  },
});

(async () => {
 await sequelize.authenticate();
})()

 // define the class with database
const plugin = new nlogin(sequelize);

 // check password
 plugin.login('name', '123456', auth => {
   console.log(auth); // return true or false
 });
 
  // get the Nlogin information about the player.
 plugin.info('name', info => {
   console.log(info); // return JSON or false
 });
 
   // get the player's email 
 plugin.get_email('name', email => {
   console.log(email); // returns result or false
 });
 
   // get the player's uuid
 plugin.uuid('name', uuid => {
   console.log(uuid); // returns result or false
 });
 
  // set the player's discord id
 plugin.set_discord('name', '9897878', discord => {
  console.log(discord); // returns true or false
 });

  // get the player's discord id
 plugin.get_discord('name', discord => {
  console.log(discord); // returns result or false
 });
 
  // set the player's email 
 plugin.set_email('name', 'email@gmail.com', email => {
   console.log(email); // returns true or false
 });
 
  // get the player's ip
 plugin.get_ip('name', ip => {
   console.log(ip); // returns result or false
 });
 
  // set the player's ip
 plugin.set_ip('name', '0.0.0.0', ip => {
   console.log(ip); // returns true or false
 });

β€’ run the following command:

node main.js