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
- Go to the Google Cloud ConsoleΒ and create a new project (or select an existing one)
- Navigate to APIs & Services > Library, search for βGoogle Drive APIβ, and click Enable
Step 2: Create OAuth 2.0 Credentials
- Go to APIs & Services > Credentials > Create Credentials > OAuth client ID
- If prompted, configure the OAuth consent screen (choose External, fill in required fields)
- Select Web application as the application type
- Add your DocsGPT URL to Authorized JavaScript origins (e.g.
http://localhost:3000) - 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
- Local:
- 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-secretAdd to your frontend .env file:
VITE_GOOGLE_CLIENT_ID=your-google-client-id| Variable | Description | Required |
|---|---|---|
GOOGLE_CLIENT_ID | OAuth Client ID from GCP Credentials | Yes |
GOOGLE_CLIENT_SECRET | OAuth Client Secret from GCP Credentials | Yes |
VITE_GOOGLE_CLIENT_ID | Same Client ID, used by the frontend to show the Google Drive option | Yes |
β οΈ
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_IDis 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. - 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.