colinbendell / homebridge-blink-for-home

Blink For Home Camera Homebridge plugin
MIT License
87 stars 27 forks source link

Throttle login requests on a 429 response #148

Open Morac2 opened 9 months ago

Morac2 commented 9 months ago

I logged out of the Blink app on my iPad today to fix an issue. When I tried to log back in I got a message that there were too many login requests and my account was locked. It told me to disable 3rd party automation and try again in 60 minutes.

When I checked the HomeBridge logs, I saw this plugin was trying to login several times a second and getting a 429 (Too many requests) response. The plug-in needs to ease back on logging in if it gets a 429 otherwise the account will get locked.

[19/09/2023, 20:18:43] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:43] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:44] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:44] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:45] [Blink] RETRY: POST /api/v5/account/login (429 ) [19/09/2023, 20:18:45] [Blink] RETRY: POST /api/v5/account/login (429 ) [19/09/2023, 20:18:46] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:46] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19/09/2023, 20:18:47] [Blink] RETRY: POST /api/v5/account/login (429 Too Many Requests) [19

Morac2 commented 9 months ago

BTW I figured out why this happened. I had noticed an iPhone 14 Pro Max in the device list in Blink. I don’t own one so I deleted it. I didn’t put 2 and 2 together until later on when I got locked out that it was actually the Blink plug-in.

That doesn’t change the fact that the plug-in shouldn’t just hammer the login server if it gets a 429. My guess is it probably got an invalid login response initially but just kept retrying because I have MFA set up and the pin field was filled with a now invalid pin.

On a side note, once I stopped the plug-in, I could get back into my account in about 10 minutes.

lu9999 commented 8 months ago

I had the same issue, I did not see any iPhone in my list, how can I fix it???

Morac2 commented 8 months ago

I had the same issue, I did not see any iPhone in my list, how can I fix it???

It may show up as a difference device. The primary way to get out of this state though is to remove the PIN code from the plug-in settings and then disable the plugin. That will stop the login attempts which will unlock the account within an hour. After that you can re-enable the plug-in and set it up as usual.