Art-of-WiFi / UniFi-API-browser

Tool to browse data exposed by Ubiquiti's UniFi Controller API
MIT License
1.1k stars 150 forks source link

Add session management to the UniFi PHP API #36

Closed ghost closed 7 years ago

ghost commented 7 years ago

For changing your browser tool, just add is this line: $_SESSION['unificookie'] = $unifidata->getcookie(); ... directly when $unifidata->login() was successful

Here some pictures for seesing the difference:

Thank you for the very nice library. I am writing some small HotSpot system with it... when everything is ready, it will also released @ Github...

malle-pietje commented 7 years ago

Thanks for this. I had already implemented something similar in a couple of projects. I haven't spent time checking what the expiry time is for the UniFi cookies though. Have you been able to confirm this?

ghost commented 7 years ago

The time seems to be about 2-5 minutes... but I don't really now it currently. When I have figured out the time @ some time, I will put that info to you ;)

Also, the session thing is nothing special, but maybe some others find it useful, so I created this request.

ghost commented 7 years ago

Cool, thanks for integrating the patch... and also thanks for fixing my comment styling :-)

The UniFi cookie timeout seems to be ~15 minutes.

malle-pietje commented 7 years ago

Thanks for your contribution! Re the comments: there's no good or bad way of doing that, I just have an obsession for consistency:smile: