Google Drive Integration
Overview
The Google Drive Explorer add-on allows you to attach and serve files directly from Google Drive. Use your existing Drive storage, share files across team members, and leverage Google’s infrastructure for reliable file delivery.
Prerequisites
- WordPress Download Manager installed
- Google Drive add-on installed and activated
- Google account
- Google Cloud Console access
Benefits
| Feature | Benefit |
|---|---|
| 15GB Free | Generous free storage |
| Familiar Interface | Easy file management |
| Team Sharing | Collaborate with shared drives |
| Google Infrastructure | Fast, reliable delivery |
| Version History | Automatic file versioning |
Google Cloud Setup
Step 1: Create a Google API Project
Go to console.developers.google.com and sign in with your Google account. Click Create Project, give it a name (for example, wpdmtest), and click Create. Once the project is ready, make sure it is selected in the project dropdown.
Copy the Project ID value and paste into the Download Manager Google Drive API Credentials settings as App ID.
Step 2: Enable Required APIs
From the left navigation menu, go to APIs & Services . Click Enable APIs and Services and search for and enable both of the following:
- Google Drive API
- Google Picker API
Both must be enabled for the integration to work.
Step 3: Configure the OAuth Consent Screen
In the left sidebar, click OAuth Consent Screen, then click Get Started. Fill in the required fields:
- App name and a user support email.
- Choose audience type: Select External for public use or Internal for Google Workspace users
- Enter developer contact email
- Agree to the terms
- click Create
You will be redirected to the OAuth overview page.
Step 4: Create OAuth Credentials
Click Create OAuth Client button and fill in the application type and a name for the client. Under Authorized JavaScript Origins, add your website domain https://your-site.com and http://localhost for testing.
Next, go to Downloads → Settings → Cloud Storage → Google Drive API Credentials in your WordPress dashboard and copy the Redirect URI shown there. Paste it into the Authorized Redirect URIs field in the Google Console. Make sure your JavaScript origin domain has no extra path suffixes. Click Create.
After creation, go to the Clients tab, click Edit, and copy the Client ID and Client Secret. Paste both values into the Download Manager Google Drive API Credentials settings in WordPress and click Save.
Application type: Web application Name: WPDM Google Drive Authorized JavaScript origins: http://localhost or https://yoursite.com Authorized redirect URIs: http://localhost/wp-admin/admin.php?page=wpdm-google-drive-callback or https://yoursite.com/wp-admin/admin.php?page=wpdm-google-drive-callback
┌─────────────────────────────────────────────────────────────┐ │ OAuth 2.0 Client IDs │ ├─────────────────────────────────────────────────────────────┤ │ Name: WPDM Google Drive │ │ Client ID: 123456789-abc...apps.googleusercontent.com │ │ Client Secret: GOCSPX-abc123... │ └─────────────────────────────────────────────────────────────┘
Step 5: Add Test Users
In the OAuth Consent Screen’s Audience section, click + Add users. Enter the email addresses of users who should have access, select them, and click Save. Confirm that the email addresses appear in the Test users list before proceeding.
Step 6: Configure Data Access (Scopes)
Go to Data Access and click Add or Remove Scopes. Browse the list and select the required Google Drive scopes. Click Update, then click Save. This completes the OAuth consent configuration.
Step 7: Create an API Key
Go to APIs & Services → Credentials and click Create Credentials → API Key. Restrict the key to the following APIs only:
- Google Drive API
- Google Picker API
Click Create. Then copy the API Key and paste it into the Download Manager Google Drive API Credentials settings. Copy the Project ID and use it as the App ID. Click Save Settings. Your Google Drive is now connected to WordPress.
Step 8: Attach Google Drive Files to a Package
Go to your Package Settings page in WordPress. Inside the Attach File section, you will now see a Google Drive button. Click it and a popup will appear, select your Google account.
If you see a warning saying Google hasn’t verified this app, this is expected for personal use apps. Click Continue to proceed. Your Google Drive files will now appear inside WordPress. Select any file to attach it to your package.
Video Tutorial
Using Google Drive Files
Adding Files to Package
- Edit a package
- In Attached Files, click Browse Google Drive
- Navigate to your files
- Select file(s)
- Click Attach Selected
File Reference Format
Files stored as Google Drive file ID:
gdrive://1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms
Download Methods
Direct Download
Files downloaded directly from Google:
☑ Direct download from Google Drive
Pros:
- Fast delivery
- No server bandwidth used
Cons:
- Less control over access
- May expose Drive file ID
Proxy Download
Route through WordPress:
☑ Proxy downloads through server
Pros:
- Full access control
- Works with all locks
- Accurate tracking
Cons:
- Uses server bandwidth
- Slower for large files
API Download
Use Google Drive API:
Pros:
- Secure access
- Supports private files
- Better rate limits
File Permissions
Public Files
For files anyone can download:
- In Google Drive, right-click file
- Click Share
- Change to “Anyone with the link”
- Copy link
Private Files (via API)
Keep files private, use API access:
- File remains private in Drive
- WPDM uses API credentials
- Download served through plugin
Shared with Specific Users
Share with your service account:
- Share file with service account email
- WPDM accesses via service account
Storage Quotas
Google Drive Limits
| Account Type | Storage |
|---|---|
| Free | 15 GB (shared with Gmail, Photos) |
| Google One 100GB | 100 GB |
| Google One 200GB | 200 GB |
| Google One 2TB | 2 TB |
| Workspace Starter | 30 GB |
| Workspace Business | 2 TB+ |
API Quotas
| Quota | Limit |
|---|---|
| Queries per day | 1,000,000,000 |
| Queries per 100 seconds | 20,000 |
| Queries per 100 seconds per user | 100 |
Troubleshooting
Red Configure button on the Package Settings page
- This means Google Drive has not been connected yet.
Go to Settings → Cloud Storage and complete the setup steps above.
Google hasn’t verified this app warning
- This is normal for apps in development or personal use. Click Continue to proceed safely.
Files not appearing after connecting
- Double check that both the Google Drive API and Google Picker API are enabled, and that your scopes are saved correctly in the OAuth Consent Screen.
Authorization Failed
Causes:
- Wrong credentials
- Redirect URI mismatch
- Consent screen not configured
Solutions:
- Verify Client ID/Secret
- Check redirect URI matches exactly
- Complete consent screen setup
- Re-authorize
File Not Found
Causes:
- File deleted from Drive
- Permissions changed
- Wrong file ID
Solutions:
- Verify file exists in Drive
- Check sharing settings
- Re-attach file
Quota Exceeded
Causes:
- Too many requests
- Large traffic spike
Solutions:
- Enable caching
- Use proxy downloads
- Request quota increase
Access Denied
Causes:
- File not shared
- Token expired
- Wrong account
Solutions:
- Share file appropriately
- Re-authorize connection
- Check connected account
Best Practices
- Organize files – Use clear folder structure
- Use shared drives – For team collaboration
- Monitor quotas – Track API usage
- Enable caching – Reduce API calls
- Backup important files – Don’t rely solely on Drive
- Regular authorization check – Ensure token is valid and picker api is enabled
Comparison with Other Storage
| Feature | Google Drive | S3 | Dropbox |
|---|---|---|---|
| Free Storage | 15 GB | None | 2 GB |
| Max File Size | 5 TB | 5 TB | 2 GB (free) |
| CDN | No (use proxy) | CloudFront | No |
| Team Sharing | Yes | IAM | Yes |
| API Limits | Generous | Pay per use | Moderate |