401 Unauthorized

I received the email that the v2 API was now available and I used the new Bond app to update the firmware on my Bond device.

ᐅ curl -i http://192.168.1.X/v2/sys/version
HTTP/1.1 200 OK
Content-Length: 142
Content-Type: application/json; charset=utf-8

{"target":"snowbird","fw_ver":"v2.9.5","fw_date":"Thu Nov  7 21:44:45 UTC 2019","uptime_s":11359,"upgrade_http":true,"api":2,"_":"5a50769f"}

I retrieved the token from the Bond app and attempted to use the API:

ᐅ curl -i http://192.168.1.x/v2/devices -X GET -d "{\"_token\": \"----------------"}"
HTTP/1.1 401 Unauthorized
Content-Length: 0

ᐅ curl -H "BOND-Token: -------------------" -i http://192.168.1.53/v2/devices
HTTP/1.1 401 Unauthorized
Content-Length: 0

I must have missed a step. Any suggestions?

Well, it looks like all your requests are formatted properly, so the token must be wrong somehow.

I recommend you power cycle the Bond (to unlock the token) then request the token via curl (curl -i http://192.168.1.x/v2/token). Is it the same as you got from the app?

We’re thinking about allowing disabling of token authentication on trusted networks, that should simplify this process…

2 Likes

Success! Rebooting the BOND generated a new token, and now all of my bond devices are in home assistant. Thank you!

2 Likes

Good to hear you got it working! Maybe the app had a wrong token? Does the app display the correct token now?

FYI the token should only change if the Bond has its database erased.