Google Calendar

Setup OAuth 2.0 Client

  1. Create Google OAuth 2.0 client (skip if you already have one). Copy CLIENT_ID & CLIENT_SECRET values.
  2. Ensure Google Calendar API is enabled for the project.
  3. Configure permission scopes to at least include calendar.events.readonly & userinfo.email in OAuth Consent Screen section.
  4. Add Authorized redirect URI in the Credentials section. You should be able to verify ownership of this domain in order publish to production.

Implement OAuth 2.0 Authorization Code Flow

https://developers.google.com/identity/protocols/oauth2/web-server#obtainingaccesstokens

Code samples from Calendar V2 Demo Repository:

πŸ“˜

Note about testing calendar connections

If your Google OAuth client is in "testing", any connections made automatically expire after 7 days. After the client has been published successfully, connections will stay connected indefinitely unless OAuth permissions are revoked, or a user changes their password.

More info on this here.


FAQ


When is the name of the invitee included on the calendar event?

For the organizer of the event (self = true) the Google Calendar API does not populate the displayName, presumably since the name is already known from their calendar connection or authentication to your platform.

For other attendees, this is more nuanced. By default, the displayName isn't populated, but Google has a few mechanisms to try to infer this by:

  1. Getting the name if the email belongs to the same Google workspace
  2. Getting the name from a Google Contact:
    1. There are many ways a Google Contact is automatically created. One common example is that Google automatically creates a Google Contact for other gmail/Google Workspace users that you've had an email with.