Skip to Content
Welcome to the new DocsGPT docs!
GuidesπŸ”— IntegrationsπŸ”— Google Drive

Google Drive Connector

Connect your Google Drive account to upload and process files directly as an external knowledge base. Supports Google Workspace files (Docs, Sheets, Slides), Office files, PDFs, text files, CSVs, images, and more. Authentication is handled via Google OAuth 2.0 with automatic token refresh.

Setup

Step 1: Create a Google Cloud Project

  1. Go to the Google Cloud ConsoleΒ  and create a new project (or select an existing one)
  2. Navigate to APIs & Services > Library, search for β€œGoogle Drive API”, and click Enable

Step 2: Create OAuth 2.0 Credentials

  1. Go to APIs & Services > Credentials > Create Credentials > OAuth client ID
  2. If prompted, configure the OAuth consent screen (choose External, fill in required fields)
  3. Select Web application as the application type
  4. Add your DocsGPT URL to Authorized JavaScript origins (e.g. http://localhost:3000)
  5. Add your callback URL to Authorized redirect URIs:
    • Local: http://localhost:7091/api/connectors/callback?provider=google_drive
    • Production: https://yourdomain.com/api/connectors/callback?provider=google_drive
  6. Click Create and copy the Client ID and Client Secret

Step 3: Configure Environment Variables

Add to your backend .env file:

GOOGLE_CLIENT_ID=your-google-client-id GOOGLE_CLIENT_SECRET=your-google-client-secret

Add to your frontend .env file:

VITE_GOOGLE_CLIENT_ID=your-google-client-id
VariableDescriptionRequired
GOOGLE_CLIENT_IDOAuth Client ID from GCP CredentialsYes
GOOGLE_CLIENT_SECRETOAuth Client Secret from GCP CredentialsYes
VITE_GOOGLE_CLIENT_IDSame Client ID, used by the frontend to show the Google Drive optionYes
CONNECTOR_ALLOWED_ORIGINSComma-separated frontend origins allowed to receive the sign-in result, e.g. https://docsgpt.example.com. Not needed when the frontend shares the API origin, or in local dev when the callback is on localhost/127.0.0.1 and the frontend runs on port 5173When the frontend is on its own origin
⚠️

Make sure to use the same Google Client ID in both backend and frontend configurations.

Step 4: Restart and Use

Restart your application, then go to the upload section in DocsGPT and select Google Drive as the source. You’ll be redirected to Google to sign in, then can browse and select files to process.

Troubleshooting

  • Option not appearing β€” Verify VITE_GOOGLE_CLIENT_ID is set in the frontend .env, then restart.
  • Authentication failed β€” Check that the redirect URI matches exactly, including ?provider=google_drive. Ensure the Google Drive API is enabled.
  • Sign-in popup closes but the account never connects β€” The frontend origin is not allowed to receive the result. Add it to CONNECTOR_ALLOWED_ORIGINS in the backend .env.
  • Permission denied β€” Verify the OAuth consent screen is configured and the user has access to the target files.
  • Files not processing β€” Check backend logs and verify that backend environment variables are correctly set.
πŸ’‘

For production deployments, add your actual domain to the OAuth consent screen and authorized origins/redirect URIs.