Describe The Bug:
When starting the plugin it cannot authenticate with the UniFi console API. The error "AxiosError: Request failed with status code 401" is reported. It looks like the API endpoint login may have been changed from "https://host:8443/api/auth/login" to "https://host:8443/api/login". More than this may have been changed with the API.
I ran curl -k -X POST https://host:8443/api/auth/login -H "Content-Type: application/json" -d '{"username":"myUsername","password":"myPassword"}' and got the response {"meta":{"rc":"error","msg":"api.err.LoginRequired"},"data":[]}
I ran curl -k -X POST https://host:8443/api/login -H "Content-Type: application/json" -d '{"username":"myUsername","password":"myPassword"}' and got the response {"meta":{"rc":"ok"},"data":[]}
To Reproduce:
Run UniFi Console version 8.1.113 or newer
Install plugin with Homebridge and configure according to documentation
Run plugin
Expected behavior:
The plugin is able to log in via the API
Logs:
[4/9/2024, 8:14:27 PM] Homebridge v1.7.0 (HAP v0.11.1) (UniFi WAP Lights) is running on port 32624.
/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/node_modules/axios/lib/core/settle.js:19
reject(new AxiosError(
^
AxiosError: Request failed with status code 401
at settle (/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/node_modules/axios/lib/core/settle.js:19:12)
at IncomingMessage.handleStreamEnd (/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/node_modules/axios/lib/adapters/http.js:589:11)
at IncomingMessage.emit (node:events:529:35)
at endReadableNT (node:internal/streams/readable:1400:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
at Axios.request (/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/node_modules/axios/lib/core/Axios.js:45:41)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at UnifiWAPLight.auth (/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/src/platform.ts:73:23)
at UnifiWAPLight.discoverDevices (/var/lib/homebridge/node_modules/homebridge-unifi-wap-light/src/platform.ts:105:3)
Describe The Bug: When starting the plugin it cannot authenticate with the UniFi console API. The error "AxiosError: Request failed with status code 401" is reported. It looks like the API endpoint login may have been changed from "https://host:8443/api/auth/login" to "https://host:8443/api/login". More than this may have been changed with the API.
I ran
curl -k -X POST https://host:8443/api/auth/login -H "Content-Type: application/json" -d '{"username":"myUsername","password":"myPassword"}'
and got the response{"meta":{"rc":"error","msg":"api.err.LoginRequired"},"data":[]}
I ran
curl -k -X POST https://host:8443/api/login -H "Content-Type: application/json" -d '{"username":"myUsername","password":"myPassword"}'
and got the response{"meta":{"rc":"ok"},"data":[]}
To Reproduce: Run UniFi Console version 8.1.113 or newer Install plugin with Homebridge and configure according to documentation Run plugin
Expected behavior: The plugin is able to log in via the API
Logs:
Plugin Config:
Environment: