Request failed with status code 401
Closed this issue · 5 comments
After updating Homebridge, Node.js, and Homebridge-verisure today to the latest versions, I get this:
[11/7/2021, 2:08:15 PM] [HB Supervisor] Restarting Homebridge...
[11/7/2021, 2:08:15 PM] [HB Supervisor] Starting Homebridge with extra flags: -I
[11/7/2021, 2:08:15 PM] [HB Supervisor] Started Homebridge v1.3.5 with PID: 47649
Initializing HAP-NodeJS v0.9.6...
[11/7/2021, 2:08:16 PM] Loaded config.json with 0 accessories and 2 platforms.
[11/7/2021, 2:08:16 PM] Loaded 0 cached accessories from cachedAccessories.
[11/7/2021, 2:08:16 PM] ---
[11/7/2021, 2:08:17 PM] Loaded plugin: homebridge-config-ui-x@4.41.2
[11/7/2021, 2:08:17 PM] Registering platform 'homebridge-config-ui-x.config'
[11/7/2021, 2:08:17 PM] ---
[...]
[11/7/2021, 2:08:18 PM] ---
[11/7/2021, 2:08:18 PM] Loaded plugin: homebridge-verisure@1.14.1
[11/7/2021, 2:08:18 PM] Registering platform 'homebridge-verisure.verisure'
[11/7/2021, 2:08:18 PM] ---
[11/7/2021, 2:08:19 PM] Loading 2 platforms...
[11/7/2021, 2:08:19 PM] [Config] Initializing config platform...
[11/7/2021, 2:08:19 PM] [Config] Running in Service Mode
[11/7/2021, 2:08:19 PM] [Verisure] Initializing verisure platform...
[11/7/2021, 2:08:19 PM] Error: Request failed with status code 401
at createError (/usr/local/lib/node_modules/homebridge-verisure/node_modules/axios/lib/core/createError.js:16:15)
at settle (/usr/local/lib/node_modules/homebridge-verisure/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/usr/local/lib/node_modules/homebridge-verisure/node_modules/axios/lib/adapters/http.js:269:11)
at IncomingMessage.emit (node:events:402:35)
at endReadableNT (node:internal/streams/readable:1343:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
It just keeps trying again every 10 seconds or so, getting a 401 error every time. I have stopped this Homebridge instance to avoid overloading the Verisure servers and them possibly banning me...
Questions regarding this:
- Why is this happening? Temporary issue? How to fix? I tried waiting a few hours with the Homebridge instance turned off before trying again, but I keep getting the same 401 errors.
- Is this behavior with continually trying over and over every 10 seconds or so the best way to handle this situation? Is there a risk that Verisure will ban my use of their unofficial API over this? Can this be improved or caught or the user more clearly notified what the issue is in this case?
Looks like your credientials needs to be updated.
- Is your config correct?
- Do you have MFA enabled for your account?
Do you have Homebridge set to restart when the process crashes? That might be the reason why you see retries every 10 seconds or so.
Looks like your credientials needs to be updated.
- Is your config correct?
It is unchanged, and it used to work, so I assume so.
- Do you have MFA enabled for your account?
Yes.
I guess I can try redoing the MFA setup and see if that fixes it. Thanks for the pointer.
Do you have Homebridge set to restart when the process crashes? That might be the reason why you see retries every 10 seconds or so.
Probably. Would prefer that the setup be resilient to temporary login hiccups, so not sure disabling it is the best solution in general. But maybe avoiding overloading Verisure's servers is outside the scope of this plugin, if it's Homebridge that's continually restarting?
I like the idea. Not sure how we can store state betweeen processes, if it crashes. Error message could be improved to clarify when credentials have expired.
Did you manage to solve the issue?