Skip to content

Google Workspace Setup

Create OAuth 2.0 credentials for Google Workspace APIs including Gmail, Drive, Docs, Sheets, Slides, and Calendar.

  • Google Cloud Console access
  • A Google Workspace organization (for Internal apps) or any Google account (for External apps)
  1. Create a Google Cloud Project

    Go to the Google Cloud Console and create a new project or select an existing one.

  2. 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
  3. 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)
  4. Add OAuth Scopes

    Add the required scopes for all Google Workspace services:

    https://www.googleapis.com/auth/gmail.modify
    https://www.googleapis.com/auth/drive
    https://www.googleapis.com/auth/documents
    https://www.googleapis.com/auth/spreadsheets
    https://www.googleapis.com/auth/presentations
    https://www.googleapis.com/auth/calendar
  5. 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”)
  6. Add Redirect URI

    Add the authorized redirect URI:

    https://api.switchboard.fpdigital.ai/oauth/google/callback
  7. Save Client Credentials

    Copy the Client ID and Client Secret. You’ll add these as environment variables.

Terminal window
npx wrangler secret put GOOGLE_CLIENT_ID
npx wrangler secret put GOOGLE_CLIENT_SECRET
VariableDescription
GOOGLE_CLIENT_IDOAuth 2.0 Client ID from Google Cloud Console
GOOGLE_CLIENT_SECRETOAuth 2.0 Client Secret from Google Cloud Console
https://api.switchboard.fpdigital.ai/oauth/google/callback
  • 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