Skip to content
API Reference
Google Calendar logo

Google Calendar

Productivity

Access and manage calendar events

Installing Google Calendar creates a resource for the upstream API and the OAuth provider Keycard needs to mint tokens for it. Your app calls Keycard’s token exchange, gets back a token scoped to Google Calendar, and uses it to call the API directly. Every exchange is governed by your zone’s identity provider, access policies, and audit log - the OAuth client secret stays inside Keycard.

OAuth permissions Keycard requests on install. Override or add scopes in Console.

https://www.googleapis.com/auth/calendar.readonly
default
https://www.googleapis.com/auth/calendar.events
default
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/calendar.freebusy
https://www.googleapis.com/auth/calendar.events.readonly
https://www.googleapis.com/auth/calendar.events.owned
https://www.googleapis.com/auth/calendar.events.owned.readonly
https://www.googleapis.com/auth/calendar.events.freebusy
https://www.googleapis.com/auth/calendar.events.public.readonly
https://www.googleapis.com/auth/calendar.settings.readonly
https://www.googleapis.com/auth/calendar.calendars
https://www.googleapis.com/auth/calendar.calendars.readonly
https://www.googleapis.com/auth/calendar.calendarlist
https://www.googleapis.com/auth/calendar.calendarlist.readonly
https://www.googleapis.com/auth/calendar.acls
https://www.googleapis.com/auth/calendar.acls.readonly
https://www.googleapis.com/auth/calendar.app.created
https://www.googleapis.com/auth/calendar.addons.execute
https://www.googleapis.com/auth/calendar.addons.current.event.read
https://www.googleapis.com/auth/calendar.addons.current.event.write

Add Google Calendar to your zone so your app can exchange tokens for it.

Step 1 - Start the install in Keycard Console

Section titled “Step 1 - Start the install in Keycard Console”
  1. In your zone’s Keycard Console, go to Resources -> Explore Resources.

  2. Search for Google Calendar and click into the catalog entry.

  3. The install dialog shows a Redirect URI. Copy it - you’ll paste it into Google Calendar in Step 2. Leave this Keycard tab open.

Step 2 - Create the OAuth app for Google Calendar

Section titled “Step 2 - Create the OAuth app for Google Calendar”
  1. Go to the Google Cloud Console
  2. Click Select a projectNew Project
  3. Enter a name and click Create
  1. Go to APIs & ServicesOAuth consent screen
  2. Select External user type (or Internal if using Google Workspace)
  3. Fill in the app name, user support email, and developer contact
  4. Add the Calendar scopes: calendar.readonly, calendar.events
  5. Add test users if the app is in “Testing” status
  1. Go to APIs & ServicesCredentials
  2. Click Create CredentialsOAuth client ID
  3. Select Web application
  4. Under Authorized JavaScript origins, add http://localhost:3000
  5. Add the Keycard-provided redirect URI under Authorized redirect URIs
  6. Click Create and note the Client ID and Client Secret
  1. Navigate to APIs & ServicesLibrary
  2. Search for “Google Calendar API”
  3. Click Enable

Step 3 - Finish the install in Keycard Console

Section titled “Step 3 - Finish the install in Keycard Console”
  1. Switch back to the Keycard install dialog you left open in Step 1.

  2. Paste the Client ID and Client Secret from Step 2.

  3. Click Add Google Calendar. The resource is provisioned and your app can start exchanging tokens for it.

Call Google Calendar from your application with a Keycard-issued token scoped to this resource.

After installing Google Calendar, your application exchanges a Keycard-issued access token for a token scoped to this resource. Pass the user’s access token as the subject_token.

from keycardai.oauth import Client, BasicAuth, TokenType
import requests
# Exchange the user's Keycard token for a Google Calendar token.
with Client(
"https://<zone-id>.keycard.cloud",
auth=BasicAuth("<your-client-id>", "<your-client-secret>"),
) as client:
response = client.exchange_token(
subject_token=user_access_token,
subject_token_type=TokenType.ACCESS_TOKEN,
resource="https://www.googleapis.com/calendar/v3",
)
# Call Google Calendar directly with the exchanged token.
r = requests.get(
"https://www.googleapis.com/calendar/v3/<endpoint>",
headers={"Authorization": f"Bearer {response.access_token}"},
)

See the OAuth SDK → Token Exchange reference for the full client API.

Common errors when wiring Google Calendar into your zone.

Error 403: Access Not Configured

The Google Calendar API hasn’t been enabled in your Google Cloud project. Go to APIs & ServicesLibrary and enable “Google Calendar API”.

Error 403: Insufficient Permission

The granted scopes don’t include the ones needed for the verification endpoint. Re-check:

  • The scopes configured in your Keycard resource
  • The scopes listed on the OAuth consent screen
  • Whether the user granted all requested scopes during consent
Error: redirect_uri_mismatch

The redirect URI in Google Cloud Console doesn’t match what Keycard sends. Copy the exact redirect URI from Keycard Console and paste it into Google’s authorized redirect URIs.

What to do once Google Calendar is installed.

Now do this

Recommended

  • Decide who can use it - write access policies scoped to the Google Calendar resource so only the right users and apps reach the API.
  • Watch the calls - every token exchange and downstream call lands in your audit log with user identity, resource, and policy decision.