Google Calendar
Setup OAuth 2.0 Client
- Create Google OAuth 2.0 client (skip if you already have one). Copy
CLIENT_ID
&CLIENT_SECRET
values. - Ensure Google Calendar API is enabled for the project.
- Configure permission scopes to at least include
calendar.events.readonly
&userinfo.email
in OAuth Consent Screen section. - 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:
- https://github.com/recallai/calendar-integration-demo/blob/v2/v2-demo/logic/oauth.js
- https://github.com/recallai/calendar-integration-demo/blob/v2/v2-demo/routes/oauth-callback/google-calendar.js#L27
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:
- Getting the name if the email belongs to the same Google workspace
- Getting the name from a Google Contact:
- 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.
Updated 5 months ago