Closed Bug 1000535 Opened 6 years ago Closed 5 years ago

Lightning frequently prompts for access to Google Calendar

Categories

(Calendar :: Lightning Only, defect)

Lightning 2.6.4
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: michael.smithers, Assigned: Fallen)

References

Details

Attachments

(2 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36

Steps to reproduce:

Open Thunderbird under Mac OSX....

Version
Thunderbird 24.4.0
Lightning 2.6.4
Provider for Google calendar 0.25
OSX 10.9.2

Calendar link (name removed)
https://apidata.googleusercontent.com/caldav/v2/<username@domain.com>/events




Actual results:

.... lightning almost always opens a prompt window asking me to enter my Google password to accept access to Google calendar.


Expected results:

I also use this setup (accessing the same mail and calendar) on other PC's (Windows 8 and 7) and they almost NEVER raise the prompt.

I'd be happy to run some tests and provide more data.
Seems the prompt was due to another (non CalDav) calendar using the Google Provider. I switched this to CalDav and the prompts have gone.
Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Resolution: --- → INVALID
Sorry to open this again. The prompts happened again today, even with the Google provider addon disabled. It's definitely still a lightning + CalDav + google problem.
Status: RESOLVED → UNCONFIRMED
Resolution: INVALID → ---
Still happens with Thunderbird 24.5.
Hello. Is anyone there?
Assignee: nobody → philipp
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Summary: Lightning frequently prompts for access to Google calendar on MAC → Lightning frequently prompts for access to Google Calendar
Attached patch Fix - v1 β€” β€” Splinter Review
This one should take care. I believe the error was occurring in the edge case where Lightning still believes the token is valid and performs a webdav-sync request. Google returns 401, which causes the auth dialog to show up.

This patch intercepts the OAuth error and triggers a reauth before it retries the request. I hope we don't run into an endless loop here, but from testing I found that if the auth dialog is cancelled then the calendar is disabled.

Given beta 3 is being built within the next day, I'm going to push this to beta without review. I'd still appreciate a review within the next few days to make sure everything is correct and to push to aurora and central.
Attachment #8455070 - Flags: review?(gasell+mozilla)
Duplicate of this bug: 966803
Target Milestone: --- → 3.3
Thanks Philip. I've been running the fix (beta) on Mac and PC for a few days now and so far everything is good.
Comment on attachment 8455070 [details] [diff] [review]
Fix - v1

Review of attachment 8455070 [details] [diff] [review]:
-----------------------------------------------------------------

After educating myself on bind(), apply() and arguments this looks good. Also, I haven't seen a single 401 in last 10 days I've used this :)
Attachment #8455070 - Flags: review?(gasell+mozilla) → review+
Comment on attachment 8455070 [details] [diff] [review]
Fix - v1

Thanks for the review. Setting checkin-needed since Trunk need approval.

This needs to be pushed on central and aurora. If it gets pushed after the merge, then it also needs to go on the new beta.
Attachment #8455070 - Flags: approval-calendar-aurora+
BTW: Even though the 401's are gone after the fix, I still get the occasional prompt dialog with a button to "Accept" access to Google calendar. Is this expected behaviour? Is it maybe related to having multiple Thunderbird clients all accessing the same calendar?
I've had this too once in a while, it might be a different but similar issue. With 3.3 final the Thunderbird final you will probably get a login dialog since the OAuth window is using private browsing mode, so it won't get better.

I'm still trying to pinpoint this issue, I have a modified Lightning 2.6.6 with some debug messages if you are interested.
Hi,

first of all thanks for working on this issue! On my machine it exists since Google changed its authentication to OAuth2. The behavior described by Michael in the initial description is exactly the same problem on my machine.

Now, after the update to Lightning 3.3 the issue has actually worsened: Before I only had to click "accept" in the Google window. Now, I also have to enter my account credentials. 

Prior to 3.3 I already tried really everything: Even uninstalling Thunderbird, deleting all Profile folders and installing everything from scratch. No success.

My setup:
* Thunderbird 31, Lightning 3.3, Windows 7 32-bit
* I have 2 Google calenders included in Lightning. Both set up as CalDav, caching disabled. The URLs I used are like "https://apidata.googleusercontent.com/caldav/v2/my.account@gmail.com/events".
* I don't use (and never did) that "Provider for Google Calendar" add-on
* Add-ons enabled in TB: Google Contacts 0.7.12, Lightning 3.3, Minimze on Start and Close 1.3.2
* Don't know whether it's important, but I usually do not shut down Windows but rather send it to Hibernate (S4).
* TB's error console doesnt show any errors, just a few warnings about getAttributeNodeNS being deprecated.

How can I help you narrowing down the issue? Do you need additional debug information?

Best regards!
Something has change in the last week or two and the problem is worse than before the July fix (when it was intermittent). On mac and PC I'm running Thunderbird 32 with Lightning 3.4b1.

Now, every time I change networks - say taking my laptop from home to work - Lightning prompts me to log into Google then prompts me to "Accept" access.

Maybe this is a change on Google's side?
I am still seeing this issue. I'm using Thunderbird 31.1.2 and Lightning 3.3.1 on Windows 7. I do not have Provider for Google Calendar installed. I am using 2-step verification for my Google account.

I have 6 calendars setup for CalDav access and auth dialog appears for each one of them. After filling in my authentication details on one of the dialogs all of the dialogs change to "Manage your calendars" and I just have to click "Accept" on each one of them.

> Now, every time I change networks - say taking my laptop from home to work - Lightning prompts me to log into Google then prompts me to "Accept" access.

The auth dialog appears whenever I change networks (or even if I attempt to change networks but do not successfully connect to a different network and then change back).
I have filtered the debug log to show all messages related to authentication for a single calendar: "en.sa#holiday". Hopefully this can shed some light on the issue.
I don't have the patch handy, but I have a potential fix for this. To try it out:

1. unzip Thunderbird's omni.ja into a directory (rename to omni.jar helps unzip figure it out)
2. locate OAuth2.jsm, delete the copy in the jsloader directory
3. find "this.refreshToken = null"
4. Change to if (aError != "offline") this.refreshToken = null
5. zip up the whole omni.jar again, don't use the zip freshen option
6. rename back to omni.jar

I hope to get around to posting a tryserver build for this soon or at least the patch itself.
Thanks Philipp. 

So far this seems to have worked!

I'll let you know if the auth dialogs come back.
Thanks! I think that fixes it also on my machine! At least I havent seen a login dialog for 3 days.

So...is it a Thunderbird bug? You guys cant fix it in the next Lightning release?
I'll make sure this gets pushed to one of the next Thunderbird 31.x releases, but in another bug. Thanks for the feedback!
Great! Thank you so much!!
I am having essentially the same problem with Mozilla/5.0 (X11; Linux x86_64; rv:35.0) Gecko/20100101 Thunderbird/35.0a2 ID:20141118004007 CSet: 6d2d158a7f3e and recent versions prior to this with the nightly gdata provider and lightning extensions for the same date.  This evening I am unable to get any calendar from google to accept the associated login credentials, even if a calendar is deleted and then installed from new using the xml private url from the associated google account. I am now getting repeated requests for the password but no calendar login at all. As a test I used the ical link to establish a read-only calendar and it works fine but of course I cannot add calendar events. Reverting to the google calendar url then fails again the same way as before.
I tried the solution from comment #17 but I could not find the file omni.ja in my thunderbird profile so I could not try the fix.
I tried to switch on the calendar and trapped the error console output:

[JavaScript Error: "uncaught exception: 2147746065"]

[JavaScript Warning: "There has been an error reading data for calendar: Google ukmobile.  However, this error is believed to be minor, so the program will attempt to continue. Error code: 0x80040111. Description: null"]

[JavaScript Warning: "There has been an error reading data for calendar: Google ukmobile.  However, this error is believed to be minor, so the program will attempt to continue. Error code: READ_FAILED. Description: "]

Maybe this helps to point to where the problem lies?
(In reply to Mike Cloaked from comment #22)

The nightly test builds are out-of-date. Provider for Google Calendar extension with version prior to 1.0 use the Google Calendar API v1 protocol that was shutdown by Google on November 17, 2014. You have to update your installation of Provider for Google Calendar to version 1.0.2. This version is currently only available from <https://addons.mozilla.org/thunderbird/addon/provider-for-google-calendar/>.
Thanks Stefan. Actually I was using the versions from https://ftp.mozilla.org/pub/mozilla.org/calendar/lightning/nightly/latest-comm-aurora/ which is the link that I get for the appropriate version from https://developer.mozilla.org/en-US/docs/Mozilla/Calendar/Calendar_Versions

I am already using version 1.02 but this seems to currently have this bug. It also seems that there has been instability for lightning/gdata provider for Thunderbird Aurora in recent weeks when the google api changed.

Can you point me to a correct link for lightning/gdata provider if the links I am using above are not the correct ones?
I should also say that the link you pointed me to at https://addons.mozilla.org/thunderbird/addon/provider-for-google-calendar/ seems to only have versions that will work with Thunderbird up to version 34a1 whereas I am using 35a2 as the Aurora version.
Thats just because AMO has no way to say "and later" automatically, or I made a mistake. It should still be installable though.
I just tried the version at https://addons.mozilla.org/thunderbird/addon/provider-for-google-calendar/ in 35a2 - it is installable in 35a2 but it does not work - ie the google calendar fails to show data  even though the calendar is not greyed out at the left side with the calendar tab selected.
I have now tried deleting the existing calendar and keeping the version referenced in comment #29 working with Thunderbird 35a2 - and then recreating the calendar using the new gdata provider (i.e. not the nightly) and it now works. The setup gui no longer requires the xml link from the calendar settings page from the google account but references the email address for the account in the setup of the calendar. This now correctly shows existing calendar events and also allows entering new events. So I am happy that this works well now so the status of closed as fixed is the correct status even for Thunderbird in the aurora channel. It would be useful for users of Thunderbird in this channel to be aware of this and possibly also for trunk?
Yes, it will be pushed for trunk in bug 1079189 once I mangle out all the major issues.
Duplicate of this bug: 1042007
You need to log in before you can comment on or make changes to this bug.