Error: Creating authorization failed - Via API

Hallo,

ich versuche seit kurzen per Nuki Web API automatisiert Smartlock Authorizations für einzelne Nuki Smartlocks zu erstellen.

Hier der Request den ich verwende:

curl --location --request PUT ‘https://api.nuki.io/smartlock/SMARTLOCK_ID/auth’ \
–header ‘Authorization: Bearer TOKEN’ \
–header ‘Content-Type: application/json’ \
–data-raw ‘{
“name”: “Test”,
“smartActionsEnabled”: false,
“remoteAllowed”: false,
“type”: 0,
“accountUserId”: ACCOUNT_USER_ID
}’

Als response bekomme ich immer 204 No Content.

Doch leider funktioniert es nicht. Im Web Dashboard wird keine erstelle Authorization angezeigt, stattdessen wird ein Fehler angezeigt:

“Error: Creating authorization failed”

Ich nehm an folgendes ist der Websocket Response:

id: …
name: “SmartlockOperationEvent”
operationId: “603fd3c0396b573c849b254b”
reference: “603fd3a2396b573c849b254a”
smartlockId: …
state: 2
type: 3

Was mache ich denn falsch? Der Fehler passiert auch wenn ich versuche direkt im Nuki Web die Authorization zu erstellen.

Kurzer Context:

Das verwendete Smartlock ist nur zum Testen und wurde nach der ersten Einrichtung vom Internet genommen und ist daher offline. Meine Idee wär einer Person per E-Mail eine App Einladung zu schicken mit der die Person dann das installierte (aber offline) Nuki aufsperren kann.

Danke!

PS: Ich hab das Topic Creating authorization failed gesehen, nur hat mir das nicht weitergeholfen bzw. geht es da eher rein um das Web Dashboard.

Hi!

The request looks fine for me and the response 204 shows, that the server accpeted the authentication and format.
If you see this error message in Nuki Web this means that the creation failed on the device itself. Has it been offline during the testing (which would explain this behaviour)?
Please remember that all authorizations are stored on the device itself for security reasons; so if you want to create them from afar (via App, Nuki Web or API) you will always need to be connected to the device in that moment.
For your scenario you could only create authorizations from within Bluetooth range or setting the device offline after you created them through the Web API.

Hello Stephan,

thanks for your response!

That’s unfortunate. I thought that authorizations are not stored on the smartlock itself and therefore it’s possible to have “offline” Nuki smartlocks installed and only use a smartphone and the Nuki app to unlock it.

Is there any way to work with Nuki without having a WiFi/Internet connection?

You would have to pre-set up everything from the Nuki App while in Bluetooth range (create App invites for other users who can then operate the device when in Bluetooth range - can also be time-restricted).
One other possibility could also be to have a Nuki Keypad and prepare several time restricted entry codes for that.

Just one more thing:

My Nuki for testing purposes is “online” (connected via bridge), but not calibrated (as I’m just using it for development purposes and haven’t attached it to a door).

I’m still experiencing random issues with creating authorizations (Error creating authorization is shown in Web UI) via CURL.

Could the issue arise from not being calibrated?

This should not really make a difference in authorization creation as long as it is set up and has a stable connection to the Nuki Bridge.

I assume you are not yet working with our new webhooks (see Nuki Developers) where yuo can also receive the error codes for fails in your application?

Everything is setup up and from time to time creating authorizations (via Postman) works as usual.

I’ll give the webhooks a try, thanks!

I also have same issue, did you find any solution?