elementary / calendar

Desktop calendar app designed for elementary OS
https://elementary.io
GNU General Public License v3.0
130 stars 39 forks source link

Calendar does not work with Google account #712

Open tlhunter opened 3 years ago

tlhunter commented 3 years ago

What Happened

I have a google account with two factor enabled. I went in an created an app-specific password for mail, which worked fine with the Mail app. I also created an app-specific password for calendar and attempted to create a CalDAV account, but that does not work.

I've attempted many URL variants based on what I could find online for the Server URL input: https://www.google.com/calendar/dav/username@gmail.com/user/ https://www.google.com/calendar/dav/username%40gmail.com/user/ https://apidata.googleusercontent.com/caldav/v2/username@gmail.com/events https://apidata.googleusercontent.com/caldav/v2/username%40gmail.com/events

For the User Name field I've attempted a few variants as well: username@gmail.com username%40gmail.com username

And for the Password I've tried the account password (fails saying I need an app specific password) and then the app specific password.

The error I receive looks like this:

Screenshot from 2021-09-27 19-15-33

Expected Behavior

I would expect the calendar authentication to work and list calendar events.

I would also expect an official guide containing common configurations for the Calendar app, or even a wizard containing popular email account types (pretty sure this existed in previous releases).

Platform Information

Most recent Odin ISO download with all updates.

dcowan-london commented 3 years ago

You can add a Google calendar by opening the Calendar app, click the Settings icon, Add New Calendar, then select "Google" from the type dropdown.

pimvullers commented 2 years ago

Tried adding it via New Calendar -> Google. But I get the same HTTP 401 error after pressing OK with my login credentials.

jeremypw commented 2 years ago

@pimvullers: I achieved this by adding my Google account to the Online Accounts section of System Settings first. At the moment this requires reducing the security settings on the account though.

devoldski commented 2 years ago

I only managed to add google calendars by using Gnome Online Accounts using Oauth2 authenticating. Is this a scenario that could be easily duplicated? https://developers.google.com/identity/protocols/oauth2

found also this message regarding 401 error when syncing https://cgit.freedesktop.org/SyncEvolution/syncevolution/plain/src/backends/goa/README:

Known Problems

When accessing CardDAV:

status-line] < HTTP/1.1 401 Unauthorized [hdr] WWW-Authenticate: AuthSub realm="https://www.google.com/accounts/AuthSubRequest" allowed-scopes="https://www.googleapis.com/auth/carddav" ... <?xml version="1.0" encoding="UTF-8"?>

GData authError Authorization Invalid Credentials

... [INFO] operation temporarily (?) failed, going to retry in 5.0s before giving up in 295.8s: PROPFIND: Neon error code 3 = NE_AUTH, HTTP status 401: Could not authenticate to server: ignored AuthSub challenge ...

This happens when using a GNOME Online Accounts which does (or did) not request CardDAV access when logging into Google. Install GNOME Online Accounts >= 3.10 or patch it (see below), "killall goa-daemon", then re-create the account in the GNOME Control Center.

Hope this helps in regards to support google calendars.

dcowan-london commented 2 years ago

Hi. I also got the same problem but it's actually because of how Google handles its account.

From what I understand, you can not use the account directly if you have two factor verification. You don't have to turn it off, though. But here's what to do:

  1. You only need to add an App Password here https://myaccount.google.com/apppasswords
  2. From there, add an app password by choosing which app you'd use (in this case it's Calendar) and where you sync it (in this case it's Others)
  3. Then Google will generate a random password for you
  4. Copy it and use the password to login with your email address in the Calendar App on elementary

This is exactly what @tlhunter tried to do originally and had issues with