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

Docker: UniFi controller login failure, please check your credentials in config/config.php! #83

Closed alfista2600 closed 4 years ago

alfista2600 commented 4 years ago

Hi,

Apologies if this is not where to ask this question, but I've searched the issues, google and UniFi community for help, and spent 2h trying to get it to work myself.

I am running a UniFi Controller on a raspberry pi using docker. I'm trying to get this to go using scyto/unifibrowser from docker hub. I'm a docker novice...but passing the credentials on the command line.

sudo docker run --name unifiapibrowser -p:8001:8000 -e USER=admin -e PASSWORD=testpass -e UNIFIURL=https://192.168.0.216 -e PORT=8443 -e APIBROWSERPASS=19a40c48cdf1c67c1c615c2basdasdasdaDAdsasdads1cafff9279a20804d93b680a4d4073f2f215d266ebe0284439b52475c1f48195 --restart unless-stopped scyto/unifibrowser

this is the output I get in the console

[Wed Oct 14 17:14:17 2020] 192.168.1.184:50038 [200]: /
[Wed Oct 14 17:14:17 2020] 192.168.1.184:50040 [200]: /css/custom.css?2.0.8
[Wed Oct 14 17:14:17 2020] 192.168.1.184:50041 [200]: /js/custom.js?2.0.8
[Wed Oct 14 17:14:17 2020] 192.168.1.184:50043 [200]: /ajax/fetch_sites.php
[Wed Oct 14 17:14:17 2020] 192.168.1.184:50037 [200]: /ajax/fetch_about_modal_metrics.php
[Wed Oct 14 17:14:23 2020] successful login for user admin
[Wed Oct 14 17:14:23 2020] 192.168.1.184:50046 [302]: /login.php
[Wed Oct 14 17:14:26 2020] 192.168.1.184:50052 [200]: /
[Wed Oct 14 17:14:26 2020] 192.168.1.184:50063 [200]: /css/custom.css?2.0.8
[Wed Oct 14 17:14:26 2020] 192.168.1.184:50064 [200]: /js/custom.js?2.0.8
[Wed Oct 14 17:14:26 2020] 192.168.1.184:50065 [200]: /ajax/fetch_sites.php
[Wed Oct 14 17:14:27 2020] 192.168.1.184:50066 [200]: /ajax/fetch_about_modal_metrics.php
[Wed Oct 14 17:14:35 2020] 192.168.1.184:50073 [200]: /ajax/update_controller.php
[Wed Oct 14 17:14:37 2020] 192.168.1.184:50075 [200]: /
[Wed Oct 14 17:14:38 2020] 192.168.1.184:50077 [200]: /css/custom.css?2.0.8
[Wed Oct 14 17:14:38 2020] 192.168.1.184:50080 [200]: /js/custom.js?2.0.8
[Wed Oct 14 17:14:42 2020] PHP Notice:  We received an HTTP response status: 400. Probably a controller login failure in /UniFi-API-browser/vendor/art-of-wifi/unifi-api-client/src/Client.php on line 196
[Wed Oct 14 17:14:42 2020] 192.168.1.184:50081 [200]: /ajax/fetch_sites.php

I am not 100% sure how to create a config file but I think I did it right, but didn't get better results...

Is there something I need to enable in the controller to make this work? I expect I'm missing something dumb...

malle-pietje commented 4 years ago

This sounds like an error with the credentials or with the syntax of the config/config.php file. Can you double-check the user name (must be an account with local access on the controller) and password?

alfista2600 commented 4 years ago

thanks, @malle-pietje - I got it working using a newly created user. I guess it didn't like the super administrator?

appreciate the help!

malle-pietje commented 4 years ago

Good to hear. It should actually work with all account types so probably this was caused by something else.