3 min read
Google Drive
Use the Google Drive API and OAuth to access authorized folders and regular files.
Adapter type: googledrive. See Common configuration for mounting instructions.
Setup
- Create a project in Google Cloud Console and enable the Google Drive API.
- Configure OAuth consent and test users, then create a Web application OAuth client.
- For Google OAuth 2.0 Playground, register
https://developers.google.com/oauthplaygroundas a redirect URI. - Enable Use your own OAuth credentials in Playground settings and enter your ID and secret. Request
https://www.googleapis.com/auth/drivewith offline access, authorize, and exchange the code. - Configure the returned
refresh_tokenwith the same app credentials. Userootor the ID following/folders/in a folder URL asroot_folder_id.
Configuration
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
client_id | string | Yes | — | OAuth application client ID. |
client_secret | password | Yes | — | Client secret for the same OAuth application. |
refresh_token | password | Yes | — | Refresh token issued for this application and account. |
root_folder_id | string | No | "root" | Root folder ID; root means My Drive. This is not a directory path. |
enable_direct_download_307 | boolean | No | false | Allow HTTP 307 redirects to an upstream download URL; the client must be able to reach it. |
Example
This is a config object. In the admin form, fill the corresponding fields rather than pasting the whole object. Replace credential placeholders with your own values.
json
{
"client_id": "YOUR_CLIENT_ID.apps.googleusercontent.com",
"client_secret": "YOUR_CLIENT_SECRET",
"refresh_token": "YOUR_REFRESH_TOKEN",
"root_folder_id": "root",
"enable_direct_download_307": false
}
Behavior and limitations
- Managing existing files requires the
drivescope;drive.filegrants access to a subset and may hide existing directories. - For external apps in Testing, refresh tokens for this access are generally subject to a seven-day lifetime; adjust publishing status under Google policies or reauthorize.
- No service-account, Shared Drive ID, or Google Docs export-format option is exposed. Native documents do not behave like regular downloadable files.
- Redirects use
webContentLink, which may require a Google browser session. Disable redirects if that fails.
Troubleshooting
- No refresh_token: check offline access and your own app credentials; revoke prior consent and authorize again if necessary.
- 403 / rate limit: verify API enablement, scopes, and actual Cloud Console quotas. Reduce request frequency after throttling.
- Folder missing: use the folder ID and verify the authorized account has access.
References
External documentation provides service and authorization context. Use this page and the current Foxel adapter for configuration fields and limitations.