-
Notifications
You must be signed in to change notification settings - Fork 121
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
New 2FA email every 24hrs #279
Comments
Yeah that's on the edge of being too quick. I think I call the built in refresh() method once every five minutes, at most and have been ok.
I've been seeing this too with a script I run. I do not see this with the v3 endpoint used in
Running a script that calls |
On that note, I'm going to see what it takes to bypass the API calls in |
This comment has been minimized.
This comment has been minimized.
Yeah I think that would help. With that said, I haven't tested the 0.16.0-rc versions with that method yet so I don't know for sure if that's the root issue.
It should. I've added as many checks I can think of to make sure this happens. If blink locks you out and you need to enter a new 2FA key, it can't handle that. With that said, I just tested with a week-old token and the library updated fine and I only noticed later that I got a new 2fa key from blink...so I think there's still something wonky on their end (or maybe I'm hitting an endpoint that generates a new 2fa key automatically or something).
No harm in doing that. My opinion is that doing it once after initial log in is fine. The only thing that will really change will be the token and the library will handle refreshing that when you start up again if it's stale. So if you have a flow like start() --> save(), then you will always save a "good" token, even if it changes some time in the future. Hopefully that makes sense.
Worth mentioning: Smartthings integrates into Home-Assistant: https://www.home-assistant.io/integrations/smartthings/ |
Well initial testing looks good. I've incorporated it into flask. I'm getting periodic processing errors but I can now much more quickly call arm/disarm functions since I don't need to do a full blink.start() each time. I'll work with it the next few days and report back including if I get the verification code requests coming through daily. |
Checking in. I've made some additional tweaks after realizing that I'd need to do a refresh before checking state of cameras and making changes (arm/disarm, etc). That seemed to work well and returns quite quickly not taxing like blink.start(). So far things seem to be working ok as I work through ways to optimize this approach. Also NOTE: I've confirmed I didn't need to use the new key that was emailed to me this morning, normal 24 hour cycle - maybe a bug on Blinks end? |
Awesome!
Yeah, seems like it. Although I have to imagine the library is hitting an endpoint in such a way that it triggers an email so I'll have to look into that. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
NOTE: I loaded RC6 yesterday and 24 hours later I did get another verify login message. |
Re-igniting this thread: I have been using blinkpy for over six months, until 2FA and release 0.16.0, it has been working great. After that I started having authentication issues. I am currently using the released version, currently 0.16.3. I need to re-authenticate every 24 hours to keep it working. I was pleased to see that code was added to automatically refresh expired tokens, but it doesn’t seem to be working in my case. Below is a diff of a log of a working session and one that needed re-authentication. I have enclosed my auth.py script that I use to re-authenticate. When I run this after 24 hours, I get the email and need to type in the code otherwise it just runs. Are others still seeing this issue? cah 4105> diff auth.log auth.log.save
#! /bin/python3 from blinkpy.blinkpy import Blink cred_file="newcred.json" |
Use Due to the 24hr email oddity, when the library goes to grab a new token it sees a new email has been sent and so will prompt you for a new code. But, at least in testing, you only need the 2FA code once when you login to get your first token and all refreshes after that do not need a token, despite the email implying the contrary. Starting with |
OK, I gave your suggestions a try and I wanted to wait 24 hours to see if they worked. They did with one caveat, I still got a 2FA email, but apparently I can just ignore it. Per your suggestions, I modified my code as follows. This modification was not obvious from the documentation. Please feel free to add it to the documentation if you desire. Thanks for helping me solve this issue. Now I have one less thing to do every morning, except to delete the email. #code to startup blinkpy 0.16 with credential file from blinkpy.blinkpy import Blink blink = Blink() |
@Kirbyrc glad it worked. As for the documentation, that exact code (sans cred file loading which is in another section) is called out in the quick start guide already here (same thing I linked earlier): https://github.com/fronzbot/blinkpy#starting-blink-without-a-prompt |
Hi guys, just wanted to confirm the setup_post_verify(), I haven't been using it but have been observing the desired behavior, 2FA email comes daily but I don't need to use the code. I use:
Should I Be adding a blink.setup_post_verify() behind blink.start()? Also @fronzbot - I noticed with the latest release I'm having very few, I think actually zero, HTTP errors, timeouts, etc. Since you released I've been up for almost the entire week now and not one error back on the interface. I only changed one thing in my integration which was to disarm the sync module before I go through my routine of individually disarming a series of cameras (due to timeouts I have this can take a few minutes to complete), then I rearm the sync module afterwards... Not sure if you've seen this behavior, that a camera connected to a disarmed sync module doesn't require as much of a resource on Blink's end to disarm? |
So one of the changes was to make the http requests look like a browser. I think that's where most of the old errors were coming from. The default python requests library sends some info like "hey, this is coming from a python requests library" but when I changed how I was handling that, the new methods didn't identify themselves and Blink started throttling those heavily (I couldn't even access anything for a few days until I figured that out). As for EDIT- and on your comment about arming/disarming- not sure. I suspect that the improved behavior is solely due to the browser identification I send (I can't think of the right term right now) so maybe they were just hyper sensitive about seeing arm/disarm requests coming from an unidentified request |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hi! There is an integration for Blink in FHEM which seems not have the issue of the constant emails. What i noticed there is that they use the v4 of the login api instead of the v3 used here. As the pin validation is part of v4 as well i wonder whether that might help with the problem. The source code for v4 login can be found here: line 174, 683 ff The function call cited from above source file also features a parameter called "reauth" which i assume could be linked to the problem here
I am not a python programmer so I am not really capable of implementing this change but maybe it helps. best regards Michael |
We use the v4 endpoint, v3 hasn't been used for some time. I have tried various permutations of the reauth parameter but that never seemed to change the result, but I'll go through that code to figure out if something different is happening (or there's a different implementation). Thanks for pointing it out! |
Just noting I ran rc0 without luck, still got the reath in 24 hours. Just installed rc1, fingers crossed... |
@swerb73 yeah same. The minute I got the email I pushed the rc1 change (which returned a slightly different response after login) so hopefully it works. Getting really annoyed with these emails haha |
Ok still haven't gotten any auth emails so I think this may be fixed! I'll push |
With the release of 0.17.0, I'm considering this closed. Hopefully we never have to re-open this 🤞 |
I upgraded to 0.17.0 and am still getting the code very 24 hours, should I change any of the parameters to stop this? |
You will need to clear your session file to generate a new uuid and token. |
OK, I should have thought of that! Just did it now and restarted the service (which normally generates a new key) and didn't get the new key message - so we might be on the right track! |
Confirming that seemed to do it for me! Man the library is clean now! |
I wanted to wait several days before replying to make sure it works. I too can confirm that this version works! Thanks @fronzbot |
hi I m using vers 0.18.0, but no way to get access nor getting an email with the access key...Is there an actual workaround? |
Been working with RC2, with some adjustments I've been able to stabilize it a bit but I definitely can't run a script more than once every 2-3 minutes as it surely barfs on me within that windows. Does anyone ever hit the blink servers that often and have issues?
Also I notice that it always sends me a new key each morning, I think it's about every 24 hours now. Still makes me think I'm using this wrong (I'm using the cred file mechanism per the other discussions), I generate a cred file initially by forcing it to send me a key then all subsequent requests I reference the cred file specifically before blink.start.
Any ideas how to prevent this or troubleshoot it?
Also any other ideas on how to better be able to run scripts more often than once every few minutes (I do this when opening/closing doors - worst case I suppose I can add a delay in my motion/door events but would rather avoid that).
Thanks!
The text was updated successfully, but these errors were encountered: