Nice to meet you, my name is Hector Alcazar, I am a fullstack developer and I have a requirement to work on the creation of a login portal. Sincerely I have not worked with RADIUS and I want to skip that step, through the API, is it possible to log users using my own database?
Yes, it’s possible, but how easy it is depends on your topology.
On successful authentication with your database, you’ll need to create a temporary hotspot user with the API using the “/ip hotspot user add” command, then call the “/ip hotspot active login” command to then bind that user to the internal IP address of the device the user is on. Ideally, you want to add an “on-logout” script at their profile that will remove the user from hotspot as soon as they log out.
If your router is in the same network as your web server, your web server will just know the IP address. If the router has a public IP, but your web server is not in the same network, you’ll need to lookup the “/ip firewall connections” menu for their connection to your web server. Your server can tell you the IP and port the client is using at the router, which is enough to uniquely identify them in there, and from there, you’ll get their private IP.
If your router does not have a public IP (i.e. you have a “double NAT” situation), and your web server is outside of the network, you’ll need to setup a VPN between the router and web server, and then proceed to use the VPN IP as if it’s a public one AND make sure users enter your web page through the VPN connection (so that you can look them up in the “/ip firewall connections”).