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

request 1: error: http status 401 Unauthorized #136

Closed
dersimn opened this issue Jul 2, 2024 · 3 comments
Closed

request 1: error: http status 401 Unauthorized #136

dersimn opened this issue Jul 2, 2024 · 3 comments

Comments

@dersimn
Copy link

dersimn commented Jul 2, 2024

After pressing the button on the Nuki Bridge I get the following error

request 1: error: http status 401 Unauthorized

Debugging with nb showed that I have to specify -E none to disable Token encryption:

  -E [none|hasedToken|encryptedToken], --encryption=[none|hasedToken|encryptedToken]
  Use encryption method for communication with the Nuki bridge.
  The default is hashedToken.

With
nb -H 10.1.1.106:8080 -T mytoken -E none -D info I get a valid response, but
nb -H 10.1.1.106:8080 -T mytoken -D info shows a similar error that is also shown in Homebridge UI:

nb info: 10.1.1.106:8080: request 1: GET /info
nb info: 10.1.1.106:8080: request 1: GET /info
nb info: warning: 10.1.1.106:8080: request 1: error: http status 401 Unauthorized
nb info: fatal: http status 401 Unauthorized

I found that this is due to homebridge-nbhb-nb-tools/lib/NbClient.js having a fixed encryption that seems to be incompatible with my bridge (idk why I'm the only one here). However changing this manually to none made it work for me: https://github.com/ebaauw/hb-nb-tools/blob/da207d4578877555c853743cc798dcdcd90546e2/lib/NbClient.js#L117

This fix unfortunately doesn't survive an update. Maybe it's possible to make the encryption configurable in homebridge's configuration.json?

@ebaauw
Copy link
Owner

ebaauw commented Jul 2, 2024

Did you double-check the clock synchronisation between the server running Homebridge and the Nuki bridge?

@dersimn
Copy link
Author

dersimn commented Jul 5, 2024

You're right.. it just took like an hour until the bridge got a valid date/time from NTP I guess.

Still any chance to have this configurable?
I usually put all smart home devices into some kind of DMZ with no internet access because I don't trust them, in this case I'd have to switch to none at some point.

ebaauw added a commit that referenced this issue Aug 14, 2024
- Add `encryption` option, see #136.
@ebaauw
Copy link
Owner

ebaauw commented Aug 14, 2024

In v1.4.23.

@ebaauw ebaauw closed this as completed Aug 14, 2024
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