twrecked / pyaarlo

Asynchronous Arlo Component for Python
GNU Lesser General Public License v3.0
50 stars 30 forks source link

Refactor 2fa #105

Open stelle11 opened 1 year ago

stelle11 commented 1 year ago

I did a complete refactoring of the 2fa authentication because of multiple issues I had related to #96. I was only using yahoo for my tests but I did multiple different tests that also covered the issue desribed in #96. These changes fixes #96 in my opinion.

The issues I had with the existing code was:

Quick description of the refactoring changes:

I did the following tests after having everything fully implemented:

I did make some changes to the code like instead of using imaplib's search function to find all mails from do_not_reply@arlo.com, I changed to get all mail ids and check the sender of the last 10 mails. The reason being that the search function did not return all mails from do_not_reply@arlo.com. The search function does not work if there's more than 10K mail ids - at least not with yahoo.

twrecked commented 1 year ago

I'll give this a try here with gmail and apple.

One thing, it's removing the SSL options change and read-only change from this commit: https://github.com/twrecked/pyaarlo/pull/104

Jopand commented 1 year ago

Tried out this change. At first I thought this PR fixed the #96 issue, but it turned out I was fooled by an existing token. When that ran out, I couldn't do a new 2fa login. So I reverted to the fix I mention in #96.