3.3 KiB
3.3 KiB
Setting up Google Drive Integration
This guide explains how to set up the Google Drive integration for DocuElevate.
Required Configuration Parameters
| Variable | Description |
|---|---|
GOOGLE_DRIVE_CREDENTIALS_JSON |
JSON string containing service account credentials |
GOOGLE_DRIVE_FOLDER_ID |
Google Drive folder ID for file uploads |
GOOGLE_DRIVE_DELEGATE_TO |
Email address to delegate permissions (optional) |
For a complete list of configuration options, see the Configuration Guide.
Step-by-Step Setup Instructions
1. Create a Google Cloud Project
- Go to the Google Cloud Console
- Create a new project or select an existing one
- Navigate to "APIs & Services" > "Library"
- Search for and enable the "Google Drive API"
2. Create Service Account
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "Service Account"
- Fill in the service account details and click "Create"
- Add appropriate roles (e.g., "Editor" for full access)
- Click "Continue" and then "Done"
- Note down the service account's email address (it will look like:
service-name@project-id.iam.gserviceaccount.com)
3. Generate Service Account Key
- Find your service account in the list and click on it
- Go to the "Keys" tab
- Click "Add Key" > "Create New Key"
- Choose JSON format and click "Create"
- The key file will be downloaded automatically
4. Share Your Google Drive Folder with the Service Account
- Navigate to the desired folder in Google Drive
- Right-click on the folder and select "Share"
- Enter the service account's email address that you noted down in step 2
- Set the permission to "Editor" (to allow the service account to create/upload files)
- Click "Send" to share the folder (you can uncheck "Notify people" as the service account won't receive emails)
5. Get Google Drive Folder ID
To find your Google Drive folder ID:
- Navigate to the desired folder in Google Drive web interface
- The URL will look like:
https://drive.google.com/drive/folders/1a2b3c4d5e6f7g8h9i0j - The string after "folders/" is your folder ID (in this example:
1a2b3c4d5e6f7g8h9i0j) - Set this value as
GOOGLE_DRIVE_FOLDER_IDin your configuration
6. Configure DocuElevate
- Open the downloaded JSON key file
- Set the entire JSON content as the
GOOGLE_DRIVE_CREDENTIALS_JSONenvironment variable - For security, ensure the JSON is properly escaped if your deployment method requires it
Domain-Wide Delegation (Optional)
If you need the service account to access files on behalf of users in your Google Workspace:
- In your Google Workspace Admin Console, go to:
- Security > API Controls > Domain-wide Delegation
- Click "Add new" and provide:
- Client ID: your service account's client ID (found in the JSON credentials file)
- OAuth Scopes:
https://www.googleapis.com/auth/drive
- Set
GOOGLE_DRIVE_DELEGATE_TOto the email address of the user to impersonate
This setup is only relevant for Google Workspace environments where you need the service account to access user-specific files.