Why is it not possible to login hotspot users via API?

Hi All,

So I’ve been trying to find a way to login a user from the Mikrotik API and I understand there’s no implementation but I don’t understand why there is no implementation as it doesn’t seem impossible from a design point of view. i.e. I can login a regular user via API, but not a hotspot user. Also the hotspot login which happens first on the client sides, still posts some information to the router and I guess saves some sort of information in the browser SESSION, so this should be certainly possible to have on the API and it would be possible to make a separate library for it.

What I don’t understand is why such a common feature doesn’t exist on the API. I could be not making any sense here or missing some important information but I’d like to be educated.
Thanks

Please describe in details what exactly yo want to do. Users log in to the router via API to send API commands, I do not understand how it is related to hotspot user logins.

I’m saying that it is not possible to perform hotspot login via API and asking why that is so…

Because it is not related to API.

API is just what you put in there, no? The question is, why is it not part of the API..

Please read documentation what eaxtly API is and what it is used for

http://wiki.mikrotik.com/wiki/Manual:API

My argument is that the Mikrotik Hotspot is part of the Router/RouterOS and supports user Hotspot login via web, but there is no API for this. I can for example create hotspot users or even manage Hotspot users from API but I can’t perform a hotspot user authentication whereas it is technically possible and also a common function.

Please give an example use case for this. What is the purpose for authenticating a user, which is not connected?

A typical example can be authenticating hotspot users automatically via API for example. Let’s say you have a button and a custom login form (different from mikrotik) and you wanted them to login via your own system. You could want a way to log them in normally and then log them in automatically via API internally.

thats already done by several companies for internal use.
API and hotspot kinda mutually irrelevant topics, unless you want to implement “alternative hotspot” via API or anything else(billing, monitoring, etc), which is also quite popular thing to write over API.

Maybe it’s possible.

I create script on router as tutorial: http://wiki.mikrotik.com/wiki/Manual:Hotspot_manual_login

After I’m calling script with Mikrotik API and pass arguments (username, password, mac-address, ip) to script.

Is it a bad choice? Is it wrong?

Thanks

Very nice! This proves my point

anyone have tried to login using api ? Anyone have any idea about how to login using api?

$API->comm('/ip/hotspot/login',false);
$API->comm('=ip=10.5.50.73', false);
$API->comm('=user=username', false);
$API->comm('=password=password');
$READ1 = $API->read(false);
$ARRAY1 = $API->parseResponse($READ1);
var_dump($ARRAY1);

And here is debugging code for this

>>> [5, 1]!done
Connected...
<<< [24] /ip/hotspot/active/login
>>> [5/5] bytes read.
>>> [5, 53]!trap
>>> [11/11] bytes read.
>>> [11, 41]=category=4
>>> [32/32] bytes read.
>>> [32, 8]=message=unknown host IP 0.0.0.0
>>> [5/5] bytes read.
>>> [5, 1]!done
<<< [14] =ip=10.5.50.73
>>> [5/5] bytes read.
>>> [5, 40]!trap
>>> [31/31] bytes read.
>>> [31, 8]=message=no such command prefix
>>> [5/5] bytes read.
>>> [5, 1]!done
<<< [14] =user=username
>>> [5/5] bytes read.
>>> [5, 40]!trap
>>> [31/31] bytes read.
>>> [31, 8]=message=no such command prefix
>>> [5/5] bytes read.
>>> [5, 1]!done
<<< [18] =password=password
>>> [5/5] bytes read.
>>> [5, 40]!trap
>>> [31/31] bytes read.
>>> [31, 8]=message=no such command prefix
>>> [5/5] bytes read.
>>> [5, 1]!done

There is no such command in that menu,

probably you want this
/ip/hotspot/active/login

It is not a good choice.
to login you should submit real password of the user. it is not a good option.

Had any one got any solution on this?

Configure your hotspot to use radius.

In your radius server you can decide which users can be logged or not.

There are many mini radius servers that can be used to make this happens with small adjustments.