"nLogin is an authentication system used by the biggest servers in Brazil now in javascript!"
โข See below the Nlogin settings in the plugin config.yml
, remember to configure MySQL.
hashing:
algorithm: "SHA256" # very important
โข download the dependencies:
npm i nlogin-js
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);
// perform player login
plugin.login('name', '12356', auth => {
console.log(auth); // return true or false
});
// register user
plugin.register({ nickname: 'name', password: '123456', email: null, discord: 12345678910 }, (register) => {
console.log(register); // return true or false
});
โข run the following command:
node main.js