Google Workspace Setup
Create OAuth 2.0 credentials for Google Workspace APIs including Gmail, Drive, Docs, Sheets, Slides, and Calendar.
Prerequisites
Section titled “Prerequisites”- Google Cloud Console access
- A Google Workspace organization (for Internal apps) or any Google account (for External apps)
Setup Steps
Section titled “Setup Steps”-
Create a Google Cloud Project
Go to the Google Cloud Console and create a new project or select an existing one.
-
Enable Required APIs
Enable the following APIs in your project from the API Library:
- Gmail API
- Google Drive API
- Google Docs API
- Google Sheets API
- Google Slides API
- Google Calendar API
-
Configure OAuth Consent Screen
Go to OAuth Consent and configure:
- User Type: Choose “Internal” for Google Workspace organizations (recommended) or “External” for broader access
- App name: Your app name (e.g., “Fp Switchboard”)
- Support email: Your email address
- Authorized domains:
fpdigital.ai(or your domain)
-
Add OAuth Scopes
Add the required scopes for all Google Workspace services:
https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/documentshttps://www.googleapis.com/auth/spreadsheetshttps://www.googleapis.com/auth/presentationshttps://www.googleapis.com/auth/calendar -
Create OAuth Credentials
Go to Credentials and:
- Click “Create Credentials” → “OAuth 2.0 Client ID”
- Select “Web application” as the application type
- Name it (e.g., “Fp Switchboard Web Client”)
-
Add Redirect URI
Add the authorized redirect URI:
https://api.switchboard.fpdigital.ai/oauth/google/callback -
Save Client Credentials
Copy the Client ID and Client Secret. You’ll add these as environment variables.
Environment Variables
Section titled “Environment Variables”npx wrangler secret put GOOGLE_CLIENT_IDnpx wrangler secret put GOOGLE_CLIENT_SECRET| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID | OAuth 2.0 Client ID from Google Cloud Console |
GOOGLE_CLIENT_SECRET | OAuth 2.0 Client Secret from Google Cloud Console |
Redirect URI
Section titled “Redirect URI”https://api.switchboard.fpdigital.ai/oauth/google/callbackImportant Notes
Section titled “Important Notes”- Access tokens expire after 1 hour
- Refresh tokens are used to get new access tokens automatically
- Users only see the consent screen on first connection