iobroker-community-adapters/ioBroker.unifi-protect

Error authorization failure

1onar opened this issue · 39 comments

unifi-protect.0 - 2023-12-16 11:32:22.488 - error - getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 - 2023-12-16 11:32:22.444 - error - getCameraList: Unifi Protect reported authorization failure

Adapter Version: 0.0.13
Node.js: v18.19.0
js-controller: 5.0.17

image

Same here.

UniFi OS v3.2.7
Network Version 8.0.24
Protect Version 2.10.11

same for me, but it seems to work for a little time, the homebridge plugin for unifi-protect works fine.

edit: the unification-adapter also works, all three (unifi-protect, unifi and homebridge) are using the same login

Looks like the same problem as here: #189 (comment)
A fix has already been merged, but no new release has been published yet. Use the newest main.js with a UDMpro > 3.2.x. 2630758

I updated my main.js file with the file from here and the adapter is still running fine :)
The same issue is with the unifi-adapter itself, but the login is done in an other way, I can't figure out how and therfor I'm not able to compare :(

iobroker-community-adapters/ioBroker.unifi#731

If anybody can help, it would be great.

The Unifi adapter uses node-unifi for authentication. Is your current version of node-unifi at 2.5.1?
iobroker-community-adapters/ioBroker.unifi#711

getApiAuthBearerToken: Unifi Protect reported authorization failure

since yesterday
Unifi OS 3.2.7

Tried the new main.js, but it did not help:

Couldn't login.
getApiAuthBearerToken: Unifi Protect reported authorization failure
getMotionEvents: Unifi Protect reported authorization failure
getCameraList: Unifi Protect reported authorization failure

UDMPRO
UniFi OS 3.2.7
Protect 2.10.11
Network 8.0.24

läuft mit den aktuellen Änderungen wieder !

It`s working again.

läuft mit den aktuellen Änderungen wieder !

It`s working again.

Welche "aktuellen Änderungen" ?
Fehlermeldungen sind mit der aktuellen main.js noch immer da.

es gibt noch eine 2. datei, die geändert wurde. protect-api.js

Installier mal den Adapter im Expoertenmodus mit der Url einfach drüber...

es gibt noch eine 2. datei, die geändert wurde. protect-api.js

Installier mal den Adapter im Expoertenmodus mit der Url einfach drüber...

Still same error:

unifi-protect.0
2023-12-31 07:32:27.686	error	getCameraList: Unifi Protect reported authorization failure

unifi-protect.0
2023-12-31 07:32:27.670	error	getMotionEvents: Unifi Protect reported authorization failure

es gibt noch eine 2. datei, die geändert wurde. protect-api.js
Installier mal den Adapter im Expoertenmodus mit der Url einfach drüber...

Still same error:

unifi-protect.0
2023-12-31 07:32:27.686	error	getCameraList: Unifi Protect reported authorization failure

unifi-protect.0
2023-12-31 07:32:27.670	error	getMotionEvents: Unifi Protect reported authorization failure

same here...

still not working :/ login authorization failure

Adapter drüber Installieren hat nicht die letzten Änderungen aus dem Repo übernommen.
Nachdem die beiden Dateien protect_api.js und main.js manuell mit der letzten Version aus dem Github-Repository ersetzt wurden, funktioniert die Anmeldung nach einem Adapter-Restart wieder.

Vielen Dank!

Adapter drüber Installieren hat nicht die letzten Änderungen aus dem Repo übernommen. Nachdem die beiden Dateien protect_api.js und main.js manuell mit der letzten Version aus dem Github-Repository ersetzt wurden, funktioniert die Anmeldung nach einem Adapter-Restart wieder.

Vielen Dank!

Beim Adapter drüberinstallieren - "per Github Link" werden bei mir die beiden Dateien protect_api.js und main.js von vor drei Wochen installiert. Aber beide Wege - manuelles Ersetzen der beiden Dateien, sowie von Github installieren beseitigen leider nicht die Fehlermeldungen, die im ca.2 Stunden-Takt erscheinen.

Welche Version der UDM usw. läuft bei dir?

UniFi UDM 3.2.9

Protect aktuell… und ja, bei mir hängt sich der Adapter auch immer noch auf. Ich habe einfach im expertenmodus einen automatischen erstarrt der Instanz alle 90 min eingerichtet.

Adapter drüber Installieren hat nicht die letzten Änderungen aus dem Repo übernommen. Nachdem die beiden Dateien protect_api.js und main.js manuell mit der letzten Version aus dem Github-Repository ersetzt wurden, funktioniert die Anmeldung nach einem Adapter-Restart wieder.
Vielen Dank!

Beim Adapter drüberinstallieren - "per Github Link" werden bei mir die beiden Dateien protect_api.js und main.js von vor drei Wochen installiert. Aber beide Wege - manuelles Ersetzen der beiden Dateien, sowie von Github installieren beseitigen leider nicht die Fehlermeldungen, die im ca.2 Stunden-Takt erscheinen.

Welche Version der UDM usw. läuft bei dir?

Hallo kailausberg,

ich habe UniFi OS 3.2.7 auf einem Cloudkey Gen2 mit Protect Version 2.10.11, Network 8.0.24 - also identisch mit deinen Versionen.
Ich habe Benutzername und Password auch nochmals in der Adapterinstanz neu eingetragen.

Danke für die Rückmeldung. Zugangsdaten hatte ich auch schon mehrmals erfolglos probiert...

ich habe das ganze mal versucht drüber zu installieren, da hat er auch was getan. jedoch schmiert das ganze nach wie vor noch ab.
kann man hier nicht eine Lösung finden?
finde es schade, dass es so gar keinen support grad gibt

Ja, schon etwas schade bzgl. des Adapters. Vor allem, da es sich bei unifi.Protect ja nicht um irgendeine Schaltsteckdose handelt..

Bei mir hagelt es jede Stunde 4 Fehlermeldungen ins Log bzwgl. des authorization failure errors. Interessanterweise werden aber trotzdem die Kamera Datenpunkte befüllt.

Selbes Problem bei mir.

unifi-protect.0 | 2024-02-08 09:04:38.286 | error | Couldn't login.
unifi-protect.0 | 2024-02-08 09:04:38.286 | error | getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 | 2024-02-08 09:04:38.281 | error | Couldn't login.
unifi-protect.0 | 2024-02-08 09:04:38.280 | error | getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 | 2024-02-08 09:04:38.278 | error | getCameraList: Unifi Protect reported authorization failure
unifi-protect.0 | 2024-02-08 09:04:38.276 | error | getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 | 2024-02-08 09:04:38.268 | error | Couldn't login.

IOBroker Info
Adapter Version: 0.0.13
Node.js: v20.11.0
js-controller: 5.0.19

Unifi Protect Info
UNVR-Pro
UniFi OS 3.2.9
Protect 2.11.21

An dieser Stelle wäre mMn ein kurzes Statement des Entwicklers nett, ob in absehbarer Zeit eine Anpassung erfolgen wird, oder ob nicht - so kann man sich generell darauf einstellen. Aktuell ist der Adapter eine Vollkatastrophe.

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

danke, das hat funktioniert.

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

Aber ändert ja nichts am Spam im Log

unifi-protect.0 - 2023-12-16 11:32:22.488 - error - getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 - 2023-12-16 11:32:22.444 - error - getCameraList: Unifi Protect reported authorization failure

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

Dazu müsste auch noch die protect-api.js ausgetauscht werden > siehe weiter oben (auch zu dem Ergebnis dessen...).

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

Aber ändert ja nichts am Spam im Log

unifi-protect.0 - 2023-12-16 11:32:22.488 - error - getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 - 2023-12-16 11:32:22.444 - error - getCameraList: Unifi Protect reported authorization failure

Bei mir nicht 🤷🏼‍♂️

Einfach die main.js mit der aus dem repository überschreiben/ersetzen und der Adapter läuft wieder 🤷🏼‍♂️👍🏻

Dazu müsste auch noch die protect-api.js ausgetauscht werden > siehe weiter oben (auch zu dem Ergebnis dessen...).

War bei mir nur die main.js und es lief wieder.
die protect-api.js ist ja auch nicht aktualisiert worden.

die protect-api.js ist ja auch nicht aktualisiert worden.

Guckst du hier (und weiter oben im thread...):
https://github.com/peterbaumert/ioBroker.unifi-protect/tree/master/protect_api

MODEDIT:
Das Repository https://github.com/peterbaumert gibt es nicht mehr.

die protect-api.js ist ja auch nicht aktualisiert worden.

Guckst du hier (und weiter oben im thread...): https://github.com/peterbaumert/ioBroker.unifi-protect/tree/master/protect_api

Ich hatte es schon gelesen und auch wahr genommen 😉 jedoch hat es auch ohne den Austausch der protect-api.js funktioniert 🤷🏼‍♂️ was ich hier einfach nur kund tun wollte 🫣

Wo genau tausche ich die files denn im iobroker aus? /opt/iobroker/node_modules/iobroker.unifi-protect hier?

EDIT: Nevermind, ist der richtige Pfad, nur via wget hat er irgendwas nicht sauber heruntergeladen. main.js und protect_api/protect-api.js richtig getauscht, nun klappts.

Bekomme auch immer diese meldung:

`

unifi-protect.0 | 2024-04-28 20:57:10.601 | error | Couldn't login. -- | -- | -- | -- unifi-protect.0 | 2024-04-28 20:57:10.601 | error | getApiAuthBearerToken: Unifi Protect reported authorization failure unifi-protect.0 | 2024-04-28 20:57:10.599 | error | Couldn't login. unifi-protect.0 | 2024-04-28 20:57:10.599 | error | getApiAuthBearerToken: Unifi Protect reported authorization failure unifi-protect.0 | 2024-04-28 20:57:10.575 | error | getMotionEvents: Unifi Protect reported authorization failure unifi-protect.0 | 2024-04-28 20:57:10.569 | error | getCameraList: Unifi Protect reported authorization failure unifi-protect.0 | 2024-04-28 20:57:10.555 | error | Couldn't login. unifi-protect.0 | 2024-04-28 20:57:10.554 | error | getApiAuthBearerToken: Unifi Protect reported authorization failure `

muss man noch die 2 Dateien tauschen und wo kann ich die downloaden???

Bitte um Information auf welchen SW Stand sich die Frage bezieht.

Version von:
Adapter:
js-controller:
node:

Generell ist das Herumkopieren von einzelnen Dateien NICHT zu empfehlen. Wenn jemand ein ein Problem gelöst hat, dann wäre es nett wenn derjenige auch einen PR erstellt damit die Lösung auch (hoffentlich zeitnahe) Eingang in eine Version findet. Die aktuelle (latest) Version basiert jedenfalls auf dem Stand von Github sodass ein Runterkopieren von Github nicht bringen wird.

unifi 8.1.113
unifi-protect. 1.0.0
Node.js: v18.19.1
NPM: 10.2.4

vielleicht liegt es ja an den erstellten benutzer das ist nämlich jetzt etwas anders wie in den ganzen videos die man so findet?

image

Hallo,
meine Voraussetzungen:

Node.js: v18.20.2
NPM: 10.5.2
Unifi Netzwerk 8.1.127
UniFi OS v3.2.12
unifi-protect. 1.0.0

Meine installierten Daten "main.js und protect-api.js" sind identisch mit den Verlinkten aus https://github.com/peterbaumert/ioBroker.unifi-protect/tree/master/protect_api

Selbige Problem "Unifi Protect reported authorization failure"
Gibt es noch Ansätze?

Danke
Micha

Meine installierten Daten "main.js und protect-api.js" sind identisch mit den Verlinkten aus https://github.com/peterbaumert/ioBroker.unifi-protect/tree/master/protect_api

Das hoffe ich doch - da https://github.com/peterbaumert/ioBroker.unifi-protect nicht mehr existiert und in die iobroker-community-adapters Orga verschoben wurde

UDMPRO:
UniFi-OS 3.2.12
Network: 8.2.93
Protect 4.0.21

Adapter:
js-controller 5.0.19
UniFi-Netzwerk 0.7.0
UniFi-Protect 1.0.0

Nodejs 18.20.3
NPM 10.7.0

Hier mal ein etwas längeres Fehlerprotokoll. Die Meldungen stehen in keinem Zusammenhang mit einer Bewegungserkennung oder der Erstellung von Snapshots uws.. Der Adapter läuft trotz der Meldungen weiter und befüllt auch die Datenpunkte einwandfrei.

host.vm-iobroker 2024-06-07 07:16:29.387 error instance system.adapter.unifi-protect.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
unifi-protect.0 2024-06-07 07:16:28.852 error Couldn't login.
unifi-protect.0 2024-06-07 07:16:28.852 error getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 07:16:28.813 error Cannot read properties of null (reading 'headers')
unifi-protect.0 2024-06-07 07:16:28.813 error TypeError: Cannot read properties of null (reading 'headers') at ProtectApi.login (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:97:36) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ProtectApi.bootstrapProtect (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:115:15) at async ProtectApi.refreshDevices (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:232:15)
unifi-protect.0 2024-06-07 07:16:28.813 error unhandled promise rejection: Cannot read properties of null (reading 'headers')
unifi-protect.0 2024-06-07 07:16:28.813 error Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
unifi-protect.0 2024-06-07 07:16:28.812 error Insufficient privileges for this user. Please check the roles assigned to this user and ensure it has sufficient privileges.
unifi-protect.0 2024-06-07 07:16:28.318 error getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 07:16:28.307 error getCameraList: Unifi Protect reported authorization failure
host.vm-iobroker 2024-06-07 05:16:19.727 error instance system.adapter.unifi-protect.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
unifi-protect.0 2024-06-07 05:16:19.161 error Cannot read properties of null (reading 'lastUpdateId')
unifi-protect.0 2024-06-07 05:16:19.161 error TypeError: Cannot read properties of null (reading 'lastUpdateId') at ProtectApi.launchUpdatesListener (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:178:75) at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
unifi-protect.0 2024-06-07 05:16:19.161 error unhandled promise rejection: Cannot read properties of null (reading 'lastUpdateId')
unifi-protect.0 2024-06-07 05:16:19.161 error Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
unifi-protect.0 2024-06-07 05:16:19.160 error 192.168.3.1: Unable to parse response from UniFi Protect. Will retry again later.
unifi-protect.0 2024-06-07 05:16:19.159 error 192.168.3.1: Controller API connection terminated because it was taking too long. This error can usually be safely ignored.
unifi-protect.0 2024-06-07 05:04:47.603 error Couldn't login.
unifi-protect.0 2024-06-07 05:04:47.603 error getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 05:04:47.101 error getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 05:04:47.084 error getCameraList: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 03:03:45.855 error Couldn't login.
unifi-protect.0 2024-06-07 03:03:45.855 error getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 03:03:45.801 error Couldn't login.
unifi-protect.0 2024-06-07 03:03:45.800 error getApiAuthBearerToken: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 03:03:45.183 error getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 03:03:45.177 error getCameraList: Unifi Protect reported authorization failure
host.vm-iobroker 2024-06-07 01:03:41.647 error instance system.adapter.unifi-protect.0 terminated with code 6 (UNCAUGHT_EXCEPTION)
unifi-protect.0 2024-06-07 01:03:41.085 error Cannot read properties of null (reading 'headers')
unifi-protect.0 2024-06-07 01:03:41.085 error TypeError: Cannot read properties of null (reading 'headers') at ProtectApi.login (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:97:36) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async ProtectApi.bootstrapProtect (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:115:15) at async ProtectApi.refreshDevices (/opt/iobroker/node_modules/iobroker.unifi-protect/protect_api/protect-api.js:232:15)
unifi-protect.0 2024-06-07 01:03:41.084 error unhandled promise rejection: Cannot read properties of null (reading 'headers')
unifi-protect.0 2024-06-07 01:03:41.084 error Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch().
unifi-protect.0 2024-06-07 01:03:41.083 error Insufficient privileges for this user. Please check the roles assigned to this user and ensure it has sufficient privileges.
unifi-protect.0 2024-06-07 01:03:40.426 error getMotionEvents: Unifi Protect reported authorization failure
unifi-protect.0 2024-06-07 01:03:40.416 error getCameraList: Unifi Protect reported authorization failure

@Scrounger
Any idea?