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#L1
- 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.
Updated 3 months ago