Community discussions

 
Tedionius
just joined
Topic Author
Posts: 12
Joined: Sat Feb 16, 2019 8:29 pm

Cannot log into Mik via PEAR2_Net_RouterOS-1.0.0b6 API

Mon Aug 05, 2019 11:24 pm

Struggling to debug this PEAR2_Net_RouterOS-1.0.0b6 issue.

MIK Model: RBSXTR
Firmware: 6.45.2
API on ROS is enabled
User exists
Password is correct
All firewall rules on MIK disbaled
Firewall rules on win7 allow incoming and outgoing port 8728
IIS ver 6.1
Localhost connection

Connecting to the MIK via http I get the following error:
10000 Invalid username or password supplied.

Connecting via CLI I get the following error:
Login refused. Possible reasons:

1. No such username.
Make sure you have spelled it correctly.

2. The user does not have the "api" privilege.
Check the permissions of the user's group at "/user group".

3. The user is not allowed to access the router from your web server's IP.
Check the "address" property at the "/user" menu.
If it's empty, that's not the problem for sure. If it's non-empty however,
make sure your IP is in that list, or is at least matched as part of an
otherwise larger subnet.

4. Mistyped password.
Make sure you have spelled it correctly.
If it contains spaces, don't forget to quote the whole password.
If it contains non-ASCII characters, be careful of your locale.
It must match that of the terminal you set your password on, or you must
type the equivalent code points in your current locale, which may display as
different characters.

In Mik logs the following:
login failure for user <user> from <API server IP> via API

BUT. Username definitely exists. Permissions = Full

Following guidance/troubleshooting from these posts:
viewtopic.php?t=50914 and
viewtopic.php?t=75449

Looks like the MIK is not parsing this line correctly:
$util = new RouterOS\Util($client = new RouterOS\Client('<My router IP', '<My username', '<My password>'));
Have also tried:
$util = new RouterOS\Util($client = new RouterOS\Client("<My router IP", "<My username", "<My password>"));
with the same result.

Anyone have any ideas? Thanks!
 
pe1chl
Forum Guru
Forum Guru
Posts: 5722
Joined: Mon Jun 08, 2015 12:09 pm

Re: Cannot log into Mik via PEAR2_Net_RouterOS-1.0.0b6 API

Mon Aug 05, 2019 11:27 pm

It probably is too old and no longer working with the current RouterOS version (there have been changes in the logon procedure recently).
So you will need to find an updated API or use another one that still is maintained.
 
Tedionius
just joined
Topic Author
Posts: 12
Joined: Sat Feb 16, 2019 8:29 pm

Re: Cannot log into Mik via PEAR2_Net_RouterOS-1.0.0b6 API

Tue Aug 06, 2019 7:29 am

Thanks pe1chl

Do you know where I could find documentation on those changes?
<< Edit >> For those looking, I found the documentation in the changelogs here: https://wiki.mikrotik.com/wiki/Manual:API#Initial_login
and more info here: https://mikrotik.com/download/changelogs

Anyone have any suggestions as to a working, current api? My requirement is to build an sms interface.
 
User avatar
mrz
MikroTik Support
MikroTik Support
Posts: 5921
Joined: Wed Feb 07, 2007 12:45 pm
Location: Latvia
Contact:

Re: Cannot log into Mik via PEAR2_Net_RouterOS-1.0.0b6 API

Tue Aug 06, 2019 12:20 pm

Who is online

Users browsing this forum: No registered users and 8 guests