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
ScopeServices
gmail.modifyGmail (read, send, labels, drafts)
driveGoogle Drive (files, folders, sharing)
documentsGoogle Docs (read, create, edit)
spreadsheetsGoogle Sheets (read, create, formulas)
presentationsGoogle Slides (read, create, edit)
calendarGoogle Calendar (events, attendees)
  • “Access blocked” error: The user’s Google Workspace admin may have restricted third-party app access. Check Admin Console > Security > API Controls.
  • Missing API error: Ensure all 6 APIs are enabled in the Google Cloud Console API Library.
  • Token refresh failure: If a user’s refresh token stops working, they need to disconnect and reconnect the service.
  1. Go to your Switchboard Dashboard
  2. Navigate to the Google Workspace service page
  3. Click Connect and complete the OAuth flow
  4. Click Test Connection to verify
  5. Try a tool call: ask your AI to “search Gmail for recent emails”