aluisiora / node-routeros

Mikrotik Routerboard RouterOS API for NodeJS
MIT License
99 stars 43 forks source link

RosException CANTLOGIN Username or password is invalid #33

Open khertg opened 3 years ago

khertg commented 3 years ago

RouterOS v6.45.9

Tried this code and says cannot login.

const RosApi = require('node-routeros').RouterOSAPI;

const conn = new RosApi({
  host: '*******',
  user: '******',
  password: '******',
});

conn
  .connect()
  .then(() => {
    // Connection successful
    console.log('Connection Successful')
  })
  .catch((err) => {
    // Got an error while trying to connect
    console.log(err);
  });

Error

RosException: Username or password is invalid
    at E:\Projects\mikrotek-test\node_modules\node-routeros\dist\RouterOSAPI.js:397:23
    at processTicksAndRejections (internal/process/task_queues.js:93:5) {
  name: 'RosException',
  errno: 'CANTLOGIN',
  message: 'Username or password is invalid'
}
ve3 commented 1 year ago

For anyone who have the same problem, don't download from release page but download from fresh code. https://github.com/aluisiora/node-routeros/archive/refs/heads/development.zip

Or you can still install from npm package. npm i node-routeros. https://www.npmjs.com/package/node-routeros

It is showing deprecated, yes. but tested from few months ago I still don't see any package that work with Mikrotik 6.x latest.