-
Notifications
You must be signed in to change notification settings - Fork 34
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
2FA not parsing mail properly? #96
Comments
I was having the same issue, however this didn't work for me. The correct format should always have a tuple that has a length of with the body in the first tuple at I haven't looked much into why it's returning a tuple with 3 items. It doesn't seem to be the correct email either, it seems to be for a "confirm your email". Could you confirm? You can add a check to ensure the message is in bytes before processing. """check if msg is bytes, then process email"""
if isinstance(msg[0][1], bytes):
for part in email.message_from_bytes(msg[0][1]).walk():
if part.get_content_type() == "text/html":
for line in part.get_payload(decode=True).splitlines():
... |
I haven't digged much more into it, but my change has worked ever since. I'm using a yahoo mail, but not sure if that makes a difference |
FYI, the mails I'm getting are titled "Your one-time authentication code from Arlo", so it's definitely the correct email it is parsing |
I had same problem (also using yahoo) and tried first by changing the index number from 0 to 1 as you suggested Jopand but that didn't solve it. |
I'm having the same problem, also using Yahoo email. With the 'if' statement, I was unsuccessful with this error: Changing the index from "[0][1]" to "[1][1]" failed with this error: Update: My workaround was to switch to outlook.com email and drop Yahoo. Working now. |
Try this for yahoo Mail if isinstance(msg[0][1], bytes):
for part in email.message_from_bytes(msg[0][1]).walk():
if part.get_content_type() == "text/plain":
for line in part.get_payload(decode=True).splitlines(): |
@Jopand I believe it’s definitely related to Yahoo’s YMail as well. That’s what I’ve been using too. @stelle11 I’m glad to here! Hopefully if this works for more people using Yahoo I can create a pull request. @jkrcknbrg I know you’ve switched over to using a different email, but if you were to try again, I found that disabling the integration for 5 minutes, and deleting all email sent from Arlo should give you a clean slate of no expired tokens. |
@qosmio I'll try out the fix tomorrow and see if it works for me as well |
The fix seems to work here as well... EDIT: Nope, seems like I was saved by a previous session. Will post the logs tonight If I revert back to my fix, it works instantly. So in my setup, this doesn't work:
but this does work: |
I made a printout of msg[0][1] and msg[0][1].. msg[0][1]: 50 ... nothing else... msg[1][1]: |
same issue for me, using Yahoo, i solved using:
|
Will this ever be fixed? Multiple users using Yahoo have this tfa issue. The solution is above. Why not take it in and make it work with Yahoo as well as other tfa sources? Since hass-aarlo has excluded the code of this project and rely entirely on the package, we can no longer manually fix the code after each update. So it is now definitively broken until something is done. |
Sorry, I'll try and take a look later. I've just managed to find time to look at this stuff again. |
I pushed a fix (and updated the alpha hass-aarlo release). Let me know if it works. I dug out an old yahoo account I had and the change works with that and gmail. |
It seems to work for me as well... Nice job 👌 |
When running 2FA, I get the following errors:
[pyaarlo] imap message read failed'int' object has no attribute 'decode'
[pyaarlo] 2fa core retrieval failed
[custom_components.aarlo] unable to connect to Arlo: attempt=1,sleep=15,error=2fa core retrieval failed
I added some printouts to debug a bit. Seems like this line is causing the issue:
pyaarlo/pyaarlo/tfa.py
Line 113 in 2d6941d
I have to change "[0][1]" to "[1][1]", then it seems to work
The text was updated successfully, but these errors were encountered: