Closed JSylvia007 closed 5 years ago
I cannot reproduce that here:
Although this is a pre-release of the API browser tool and a more recent API client version, nothing major has changed. The only major change that was recently implemented was to deal with nginx reverse proxies mangling the responses.
Have you tried connecting to a previous controller version? You always test using the UBNT demo controller which currently runs 5.9.29:
https://demo.ui.com:443
user: demo
password: demo
Please share (anonymized) debug output if you keep encountering issues.
I pushed a new version of the API browser tool to the repository which includes the latest API client class. Can you try out this version to see whether it fixes your issue?
Ok... So it works when pointed to the demo site... Am I missing a configuration step within the UniFi controller software perhaps?
Is this controller one that has been frequently upgraded over time or is it a fresh install? Could be some inconsistency in the database (not likely) or maybe a reverse proxy in front of the controller that is mangling the output?
Otherwise, enable debug in the config file and look through the debug output for clues.
My install was a fresh install of 5.9 and I upgraded over the weekend to 5.10. My goal is to eventually setup some scripts on the command line to interface with Zabbix and control presense status of certain devices (am I home?, etc.).
I don't believe that there is a reverse proxy. It's just an apache instance running on Ubuntu 18.04.
I've been following this as well: https://community.ubnt.com/t5/UniFi-Wireless/After-upgrade-to-5-10-12-api-login-giving-app-err-invalid/m-p/2671107
Debug Output:
-----------LOGIN-------------
Array
(
[url] => https://unifi.domain.com:8443/api/login
[content_type] => application/json;charset=UTF-8
[http_code] => 400
[header_size] => 309
[request_size] => 241
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.839083
[namelookup_time] => 0.004345
[connect_time] => 0.004724
[pretransfer_time] => 0.046092
[size_upload] => 42
[size_download] => 57
[speed_download] => 67
[speed_upload] => 50
[download_content_length] => 57
[upload_content_length] => 42
[starttransfer_time] => 0.839024
[redirect_time] => 0
[redirect_url] =>
[primary_ip] => 10.1.2.6
[certinfo] => Array
(
)
[primary_port] => 8443
[local_ip] => 10.1.2.60
[local_port] => 45954
)
----------RESPONSE-----------
HTTP/1.1 400
vary: Origin
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: Access-Control-Allow-Origin,Access-Control-Allow-Credentials
X-Frame-Options: DENY
Content-Type: application/json;charset=UTF-8
Content-Length: 57
Date: Mon, 11 Feb 2019 14:27:51 GMT
Connection: close
{"meta":{"rc":"error","msg":"api.err.Invalid"},"data":[]}
-----------------------------
I AM AN IDIOT...
I AM USING THE WRONG PASSWORD. I ORIGINALLY HAD A WEAK PASSWORD AND CHANGED IT BUT FORGOT TO CHANGE IT IN THE CONF FILE...
I PUBLICLY APPOLOGIZE FOR MY IGNORANCE. LOL LOL LOL
No problem;-) Typical case of RubberDucking :wink: https://www.youtube.com/watch?v=huOPVqztPdc
I am interested in trying this UniFi API tool, BUT, it appears that the latest version (5.10.12) breaks the API apparently...
I've tried with a simple bash script:
username="admin"
password="MyPassword"
baseurl="https://unifi.domain.com:8443"
curl --data "{\"username\":\"$username\", \"password\":\"$password\"}" $baseurl/api/login
And this results in:
{"meta":{"rc":"error","msg":"api.err.Invalid"},"data":[]}
The actual error in the API Browser is: