jobisoft / EAS-4-TbSync

[Thunderbird Add-On] The Exchange ActiveSync provider for TbSync to sync contacts, tasks and calendars to Thunderbird.
https://github.com/jobisoft/EAS-4-TbSync/wiki/About:-Provider-for-Exchange-ActiveSync
Mozilla Public License 2.0
197 stars 28 forks source link

Periodic reauth requests #271

Closed stenoo83 closed 2 months ago

stenoo83 commented 3 months ago

TbSync version: 4.11 EAS-4-TbSync version: 4.11 Thunderbird version: 128.1.0esr (64 bit)

I still get periodic reauth requests. It doesn't ask for the username/password; it only asks for the multi-factor authentication code.

ewolff commented 3 months ago

In my case, the login window of Office 365 pops up and closes immediately again. I am not asked for any credentials. In addition this morning, I had to re-login after restarting the machine and opening Thunderbird again.

ewolff commented 3 months ago

I restarted Thunderbird and needed to reauthenticate with Office 365. I immediately restarted Thunderbird and didn't have to reauthenticate with my password.

jobisoft commented 3 months ago

Looks like a lifetime issue. I will try to investigate.

henrygouk commented 2 months ago

Sounds like @stenoo83 has the same issue I mentioned in the discussion on #267. For completeness, I'm using the same versions and the issue persists with a new Thunderbird profile and setting up accounts in TbSync again.

ewolff commented 2 months ago

I deleted the TbSync account and set it up anew. That did not fix the problem. Just had to re-authenticate after a reboot.

jobisoft commented 2 months ago

Re-authenticate means the mfa token, or your password?

ewolff commented 2 months ago

Re-authenticate means the mfa token, or your password?

Password. Sorry for not being clear.

1lutz commented 2 months ago

I have the same problem. Periodically a popup opens where I have to select my account. No credentials asked. You can see the popup below.

I created my Microsoft account using a GMail address and had to use a new @outlook.com alias to login when creating the account in Thunderbird. Maybe this makes a difference.

grafik

lckarssen commented 2 months ago

I'm observing the same. The TBsync standard debug log doesn't seem to show anything useful at the default level:

** Fri Aug 23 2024 17:26:28 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: prepare.request.options, Account: Office 365

** Fri Aug 23 2024 17:26:28 GMT+0200 (Midden-Europese zomertijd) **
[Sending] : OPTIONS https://outlook.office365.com/Microsoft-Server-ActiveSync

** Fri Aug 23 2024 17:26:28 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: oauthprompt, Account: Office 365

I'll increase the logging level and will report back.

igzmanuelmartinvivaldi commented 2 months ago

Same problem here: required to enter password every reboot. Lot of timezone errors at launch but I´m not sure if they are related to this problem: image

Addrick commented 2 months ago

Hey I have the same issue and I don't think this has been mentioned yet but I think I started getting the issue immediately after upgrading Thunderbird to 128.1.1esr. I can't say for certain what version I was on prior to the upgrade but the login window started appearing with the update notification.

Also, thank you for creating this addon!

lckarssen commented 2 months ago

After increasing the log level and restarting my PC this morning, I had to re-authenticate with my O365 account. Since then it has run fine for about 2 hours and just presented me with a window for the OTP code only. The log doesn't really show much, unfortunately. Below you see three messages from the last successful sync at 10:47. followed by the one that requested the re-auth at 11:18.

** Mon Aug 26 2024 10:47:54 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: prepare.request.localchanges, Account: CHU Office 365, Folder: BIFnew

** Mon Aug 26 2024 10:47:54 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: done, Account: CHU Office 365

** Mon Aug 26 2024 10:47:54 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: accountdone, Account: CHU Office 365

** Mon Aug 26 2024 11:18:48 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: prepare.request.setdeviceinfo, Account: CHU Office 365

** Mon Aug 26 2024 11:18:48 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: send.request.setdeviceinfo, Account: CHU Office 365

** Mon Aug 26 2024 11:18:48 GMT+0200 (Midden-Europese zomertijd) **
[setSyncState] : State: oauthprompt, Account: CHU Office 365

I'm syncing a single calendar, with a 30 minute interval.

I have now decreased the interval to 10 minutes. Maybe syncing more often helps to keep the auth alive?

d-schiffner commented 2 months ago

I was looking through the code and found (while debugging) the following in network.js:

https://github.com/jobisoft/EAS-4-TbSync/blob/master/content/includes/network.js#L216-L231

Here, the tokens are accessed as properties, while in the remaining code getToken is being used. While debugging, I get the following output in the console:

oauth.accessToken
null
oauth.refreshToken
null
oauth.tokenExpires
0 

While using the "getters":

oauth.getToken("accessToken")
"eyJ0eXAiOiJKV1QiLC... <REDACTED>"
oauth.getToken("refreshToken")
"0.ATAAp7-<REDACTED>"
oauth.getToken("tokenExpires")
1724673136668 

I have the breakpoint in line 416 of network.js, where the state is oauthprompt.

It seems, that in this case the tokens are not being sent over, hence the login form will be presented

1lutz commented 2 months ago

Nice work, @d-schiffner 👍 Looks promising.

lckarssen commented 2 months ago

I have now decreased the interval to 10 minutes. Maybe syncing more often helps to keep the auth alive?

Nope, doesn't seem to be the case. I still got a prompt.

TheTrueBumba commented 2 months ago

I was looking through the code and found (while debugging) the following in network.js:

https://github.com/jobisoft/EAS-4-TbSync/blob/master/content/includes/network.js#L216-L231

Here, the tokens are accessed as properties, while in the remaining code getToken is being used. While debugging, I get the following output in the console:

oauth.accessToken
null
oauth.refreshToken
null
oauth.tokenExpires
0 

While using the "getters":

oauth.getToken("accessToken")
"eyJ0eXAiOiJKV1QiLC... <REDACTED>"
oauth.getToken("refreshToken")
"0.ATAAp7-<REDACTED>"
oauth.getToken("tokenExpires")
1724673136668 

I have the breakpoint in line 416 of network.js, where the state is oauthprompt.

It seems, that in this case the tokens are not being sent over, hence the login form will be presented

Did you make a beta version with the new code? The issue was resolved?

jobisoft commented 2 months ago

@d-schiffner : Thanks for the pointer. Here is a preview of v4.12 which includes https://github.com/jobisoft/EAS-4-TbSync/commit/4f6c340ba390a622829bf0065826255329073676

EAS-4.12.zip

Does that work for you?

d-schiffner commented 2 months ago

Your welcome :)

I gonna give it a try. A fresh restart of Thunderbird with 4.12 did not create the rompt for me.

TheTrueBumba commented 2 months ago

Installed 4.12 here. In my corporate account the plugin asked for the password once a day. I will wait 48 hours and return here with the results. @jobisoft tnxs for the fast release and @d-schiffner tnxs for the code investigation.

henrygouk commented 2 months ago

Just installed the v4.12 preview and stepped through the asyncConnect method in the debugger; it successfully refreshed an expired token, so hopefully the issue is resolved.

jobisoft commented 2 months ago

I think v4.12 should be released. I had no auth popup since I installed it. Is there any negative feedback on v4.12?

Giermann commented 2 months ago

I did not run it long enough to give any feedback about the popups yet, but for me there's no disadvantage over v4.11 - so yes, feel free to release it.

d-schiffner commented 2 months ago

I would ship it. No errors yet.

TheTrueBumba commented 2 months ago

No pop-us on 4.12 after 36 hours of use. Problem seems to be solved.

jobisoft commented 2 months ago

Released.

ArJo45 commented 2 months ago

I have two personal outlook accounts . I receive "status 451" occasionally, typically once a day. I have installed the add ons Tb sync 4.11 and Provider for Exchange 4.11. I updated the latter to version 4.12 and do still receive "status 451" as with version 4.11. I have Thunderbird installed on a desktop and a laptop, both with the same "status 451" symptom. Both machines are shut down at night and restarted in the morning.

jobisoft commented 2 months ago

I have two personal outlook accounts . I receive "status 451" occasionally, typically once a day. I have installed the add ons Tb sync 4.11 and Provider for Exchange 4.11. I updated the latter to version 4.12 and do still receive "status 451" as with version 4.11. I have Thunderbird installed on a desktop and a laptop, both with the same "status 451" symptom. Both machines are shut down at night and restarted in the morning.

I have observed this as well. Please open a new issue with TbSync for tracking: https://github.com/jobisoft/TbSync/issues

stenoo83 commented 2 months ago

Released.

where?