bkaankose / Wino-Mail

Built-in Mail & Calendars app clone for Windows.
https://www.winomail.app/
GNU General Public License v3.0
781 stars 35 forks source link

[Bug] Gmail authentication does not work after a period of being offline #447

Open lostmsu opened 1 month ago

lostmsu commented 1 month ago

Describe the bug After a couple of days of PC being off, Gmail won't synchronize.

Expected behavior When Gmail token expires it has to be refreshed.

Additional context Happens because IsExpired returns false, but Gmail refuses the token.

It could be this issue: https://github.com/praeclarum/sqlite-net/issues/217 (I'm in UTC-7) Basically to correctly preserve timezone (UTC in this case) when storing timestamp in SQLite-net one must use DateTimeOffset. Although I tried a roundtrip, and the comparison with incorrect kind seems to work correctly.

But actually since there's GmailClientMessageHandler it could check the return code, and force token regeneration on Unauthorized (I would suggest to only do it once per request). Should be doable by adding response handler with messageHandler.AddUnsuccessfulResponseHandler(new ...()); in GmailSynchronizer constructor.

bkaankose commented 1 day ago

Wino used to handle gmail tokens, but for the next update they'll be managed by Google auth library.