Google Drive
Uploading and downloading Google Drive files, for example saving a generated document or offering files for download on the site.
Connection type: For the app and the agent. Sign-in: Sign in with a Google account in the provider's window and approve the permissions listed below. No passwords or keys are entered in Bloklo.
How it works
The app and the agent never see the credentials. They call the Google Drive API through the Bloklo gateway, for example fetch("/gw/<connection id>/drive/v3/files"). The gateway appends the path to the address https://www.googleapis.com, adds an access token from the Google sign-in, renewed automatically, and passes the service's response back to the app.
- Reads (GET) go through at once. Writes (POST, PUT, PATCH, DELETE) go through at once only when the connection is set to Always allow; otherwise the gateway returns status 202 with an
approval_idand the write waits for approval in the panel (see Agent permissions). - The Test button sends
GET /drive/v3/about?fields=userand checks that the service accepted the credentials.
Drive API v3 at www.googleapis.com with JSON bodies; with the drive.file scope only files created by the app or opened by the user are visible. List calls should set the fields parameter; further pages use pageToken from nextPageToken. Files up to 5 MB upload in one multipart request to /upload/drive/v3/files, larger ones use resumable upload.
Before you start
- A Google account with access to the data the app should use.
Connecting in Bloklo
- Open Connectors in the sidebar and find Google Drive.
- Click Connect and enter a connection name in Details.
- Click Connect. The Google sign-in window opens.
- Choose the Google account and approve the permissions. After approval you return to Bloklo and the connection is active.
- Attach the connection to a project: Attach to a project… on the connection page, or describe the task in the project chat.
Until Google verifies the Bloklo app, the sign-in window may warn that the app is unverified. To continue, choose Advanced and then Go to bloklo.com. Until then at most 100 Google accounts can connect.
Provider permissions
Bloklo asks Google for exactly these scopes: https://www.googleapis.com/auth/drive.file. Access can be revoked at any time by removing the connection in Bloklo or in the Google account settings.
Bloklo can access only the files it created or that were opened through Bloklo. It does not see and cannot change the other files on Drive.
Example prompts
Prompts to type in the chat of a project with the connection attached:
- “Add a form that saves uploaded photos to a Drive folder.”
- “Build a page listing files from a chosen folder with preview links.”
- “Add a button that downloads the contract as a PDF exported from a Google document.”
API methods
The most commonly used Google Drive API methods. The path goes after /gw/<connection id>; parts in braces, such as {id}, are replaced with values. The gateway treats every request other than GET as a write, including queries sent with POST (such as search or GraphQL), so they need approval unless the connection is set to Always allow. The full list of methods is in the provider's documentation.
| Method | Path | What it does | In the gateway |
|---|---|---|---|
GET | /drive/v3/files | List files with a q filter | read |
GET | /drive/v3/files/{fileId} | File metadata or download (alt=media) | read |
GET | /drive/v3/files/{fileId}/export | Export a Google file to PDF or another format | read |
POST | /drive/v3/files | Create a folder or file metadata | write (approval) |
POST | /upload/drive/v3/files | Upload a file (multipart or resumable) | write (approval) |
PATCH | /drive/v3/files/{fileId} | Rename, move or update metadata | write (approval) |
POST | /drive/v3/files/{fileId}/copy | Copy a file | write (approval) |
POST | /drive/v3/files/{fileId}/permissions | Share a file | write (approval) |
DELETE | /drive/v3/files/{fileId} | Delete a file | write (approval) |
GET | /drive/v3/about | Account info and storage quota | read |
Service limits
325,000 quota units per minute per user and 1,000,000 per minute per project. Uploads: 750 GB per user per day, files up to 5 TB. Export of Google files is limited to 10 MB. files.list: pageSize at most 1,000. Exceeding limits returns 403 userRateLimitExceeded or 429; retry with exponential backoff.
Agent actions and permissions
| Action | Type | What the agent uses it for |
|---|---|---|
| Read data | read | Fetches data from the service, such as a list of records, to build and check the app. Examples: list files with a q filter; file metadata or download (alt=media); export a Google file to PDF or another format. |
| Write data | write | Requests other than GET: creating, changing or deleting data in the service, and also queries sent with POST (such as search). Examples: create a folder or file metadata; upload a file (multipart or resumable); rename, move or update metadata. |
By default, reads run without asking and writes need approval in the chat. Change this on the connector page or in Settings → Agent permissions (see Agent permissions).
Troubleshooting
The connection says it needs reconnecting
Access was revoked in the Google account, expired, or the password changed. Open the connection and click Authorize.
The test returns HTTP 403
The account has no access to this data, or some permissions were unticked during sign-in. Reconnect and approve all permissions.
Limits and security
- One connection can make up to 1,000 requests per minute; the service's own limits also apply.
- Credentials are encrypted and not shown in the browser after saving; only the names of stored fields are visible.
- A published app works for every visitor: protect the data the connection gives access to with sign-in in the app.
Something unclear or out of date? Contact us