Google Drive
Google Drive connects with OAuth 2.0 through Truto's Google app or your own.
Install the Google Drive integration
Install Google Drive from Available integrations in each environment you connect accounts from.
Use your own Google Drive OAuth app
Truto connects Google Drive accounts through its own OAuth app, so this step is optional. To show your own app on the consent screen instead:
- Create an OAuth client in the Google Cloud console and add
https://api.truto.one/connect/googledrive/callbackas its redirect URL. If you use a redirect URL on your own domain, add that URL instead. - Enter the app's Client ID and Client Secret on the installed Google Drive integration. See Overriding OAuth credentials.
By default, Truto asks Google Drive for these scopes. The Connect UI lists them under Permissions required, and you can change them when you override the OAuth credentials.
https://www.googleapis.com/auth/drive.readonlyhttps://www.googleapis.com/auth/drive.labels.readonlyhttps://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/userinfo.profileopenidhttps://www.googleapis.com/auth/drive.file
Enable the same scopes on your app. If your app allows fewer, change the list under Use your own OAuth settings → Scopes on the installed integration's Configuration tab to match.
Connect a Google Drive account
- In Integrated Accounts, click Connect Account.

- Enter a Tenant ID (your customer's ID; Truto creates the tenant if it is new), or pick one under Existing tenant (optional). Check the Environment and the Region (where Truto places the account; Western North America by default). To open the link straight on Google Drive, pick it under Advanced settings → Integration (optional). Click Get connection link.

- Click the open-in-new-tab button, or click Copy and send the link to your customer so they connect their own Google Drive account. The link works for 7 days, until an account is connected with it.

- Click Get Started if it shows, then select Google Drive.

- Log in to your Google account and allow access to Truto.
- Close the tab when you see Connection successful. The new account appears under Integrated Accounts. Click its Account ID to see its details and make API calls.
Check the scopes the user granted
Google lets users untick individual scopes on the consent screen, and the connection still succeeds. Right after it does, read the account with GET /integrated-account/{id} and compare context.oauth.token.scope with the scopes you need. If any are missing, ask the user to reconnect and grant them.
A connection validation request fails the connection when it needs a scope the user left out. A call that fails later for a missing scope returns 403 with truto_error_insight.forbidden_error.value.refusal_basis set to scopes_missing; see Insights.
Receive file changes as webhooks
Truto doesn't create Google Drive notification channels for you. To receive Drive changes as unified record:* events on file-storage/drive-items:
- Pick a secret and save it on the integrated account as a
webhook_secretvariable: Integrated Accounts → the account → Details → Variables → Edit variables (Add variables when it has none). - Install the File Storage Unified API in the environment. Truto turns Google Drive notifications into
record:*events only through it; without it, events are dropped. - Subscribe a Truto webhook to
record:created,record:updatedandrecord:deleted, orall. See Creating a webhook. - Create a watch channel through the Proxy API. Set
addressto the account's webhook URL andtokento a query string that holds your secret ass. Truto drops every notification whose token doesn't carry the right secret.- To watch every change in the account, get a start token from the
changes-start-page-tokenresource, then callchanges-watchwith it aspageToken. - To watch one file or folder, call
watchwithfile_id.
- To watch every change in the account, get a start token from the
- Google expires each channel. Create a new one before it expires; stop an old one with the
channelsresource'sdeletemethod.
curl -X POST "https://api.truto.one/proxy/changes-watch?integrated_account_id=<integrated_account_id>&pageToken=<start_page_token>" \
-H "Authorization: Bearer $TRUTO_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"id": "4b1f6c2e-8d3a-4f5b-9c7e-2a1d0e9f8b7c",
"type": "web_hook",
"address": "https://api.truto.one/integrated-account-webhook/<integrated_account_id>",
"token": "s=<webhook_secret>"
}'| Google Drive notification | Truto event |
|---|---|
Changes channel: change |
record:updated, with only the drive in the record (add &d=<drive_id> to token to name a shared drive) |
File channel: add |
record:created |
File channel: update, untrash |
record:updated |
File channel: trash, remove |
record:deleted |