jacobalberty / unifi-docker

Unifi Docker files
MIT License
2.14k stars 454 forks source link

UniFi User management library aiounifi not implemented #771

Open cinghialino opened 5 days ago

cinghialino commented 5 days ago

Operating system

doesn't matter

UniFi Tag

latesr

Docker run

irrelevant

Bug description

it appears that the library component responsible for user management aiounifi is oot implemented, as reported in this link. https://github.com/ufozone/ha-unifi-voucher/issues/125#issuecomment-2363541967

I am wondering if it could be implemented in your already great docker image.

Thanks!

Steps to reproduce

No response

Relevant log output

2024-09-20 11:33:02.725 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://10.0.99.133:32770) get, None, False
2024-09-20 11:33:02.796 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://10.0.99.133:32770) 302 application/octet-stream <ClientResponse(https://10.0.99.133:32770) [302 None]>
<CIMultiDictProxy('Location': '/manage', 'Content-Length': '0', 'Date': 'Fri, 20 Sep 2024 11:33:02 GMT')>

2024-09-20 11:33:02.796 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://10.0.99.133:32770) b''
2024-09-20 11:33:02.796 DEBUG (MainThread) [aiounifi.interfaces.connectivity] Talking to UniFi OS device: False
2024-09-20 11:33:02.797 DEBUG (MainThread) [aiounifi.interfaces.connectivity] sending (to https://10.0.99.133:32770/api/login) post, {'username': 'test', 'password': 'test', 'rememberMe': True}, True
2024-09-20 11:33:03.587 DEBUG (MainThread) [aiounifi.interfaces.connectivity] received (from https://10.0.99.133:32770/api/login) 400 application/json <ClientResponse(https://10.0.99.133:32770/api/login) [400 None]>
<CIMultiDictProxy('Vary': 'Origin', 'X-Frame-Options': 'DENY', 'Content-Type': 'application/json;charset=UTF-8', 'Content-Length': '57', 'Date': 'Fri, 20 Sep 2024 11:33:02 GMT', 'Connection': 'close')>

2024-09-20 11:33:03.587 DEBUG (MainThread) [aiounifi.interfaces.connectivity] data (from https://10.0.99.133:32770/api/login) b'{"meta":{"rc":"error","msg":"api.err.Invalid"},"data":[]}'
2024-09-20 11:33:03.587 ERROR (MainThread) [aiounifi.interfaces.connectivity] Login failed '{'meta': {'rc': 'error', 'msg': 'api.err.Invalid'}, 'data': []}'
2024-09-20 11:33:03.587 WARNING (MainThread) [custom_components.unifi_voucher] Connected to UniFi Network at 10.0.99.133 but login required:
jacobalberty commented 5 days ago

There shouldn't be anything to implement, this image just uses the standalone unifi installation inside of a docker image. I see mentions of UniFi OS though is this something that only works on UniFi OS and not the standalone install?

cinghialino commented 5 days ago

yeah it appears that the docker image does not contains the aiounifi library - preventing me to use a "hotspot manager" only user when accessing it through this software. It's not the end of the world, I just wanted to make you aware that something may (or may not) be missing in the image, and for the sake of curiosity, you may want to investigate. Again, thank you for your work.

jacobalberty commented 5 days ago

aiounifi is a python interface for unifi, you wouldnt put it in the docker image you use it to connect to a unifi controller, you use it externally to it, ha-unifi-voucher includes aiounifi itself and is where aiounifi would need to exist for this to work. It looks like you're getting a 400 bad request and aiounifi is intepreting that as unauthorized.

I would check the contents of your /unifi/log folder to see if any of the messages there seem relevant. Try a login with a hotspot user and see if its giving an error message in access.log or server.log there's also a hotspot.log that might be relevant, i'm not sure how relevant the other log messages would be.