Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade UniFi Controller Version 5.10.12 breaks login #60

Closed
JSylvia007 opened this issue Feb 11, 2019 · 8 comments
Closed

Upgrade UniFi Controller Version 5.10.12 breaks login #60

JSylvia007 opened this issue Feb 11, 2019 · 8 comments

Comments

@JSylvia007
Copy link

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:

HTTP response status: 400
This is probably caused by a UniFi controller login failure. Please check your credentials and try again.

@malle-pietje
Copy link
Collaborator

malle-pietje commented Feb 11, 2019

I cannot reproduce that here:
5 10 12

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

@malle-pietje
Copy link
Collaborator

Please share (anonymized) debug output if you keep encountering issues.

@malle-pietje
Copy link
Collaborator

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?

@JSylvia007
Copy link
Author

Ok... So it works when pointed to the demo site... Am I missing a configuration step within the UniFi controller software perhaps?

@malle-pietje
Copy link
Collaborator

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.

@JSylvia007
Copy link
Author

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":[]}
-----------------------------

@JSylvia007
Copy link
Author

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

@malle-pietje
Copy link
Collaborator

No problem;-) Typical case of RubberDucking 😉
https://www.youtube.com/watch?v=huOPVqztPdc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants