Integrations allow your app to access external services (Google Sheets, Drive, etc.) on behalf of users through OAuth.
Declaring Integrations
Define in inf.yml:
yaml
1integrations:2 - key: google.sheets3 description: Access to read/write Google Sheets4 optional: false5 6 - key: google.drive7 description: Access to Google Drive files8 optional: trueProperties
| Property | Type | Description |
|---|---|---|
key | string | Integration identifier |
description | string | Shown to users |
optional | boolean | If false, app won't run without it |
Available Integrations
List all available integrations:
bash
1infsh integrations listCommon Integrations
| Key | Description |
|---|---|
google.sheets | Read/write Google Sheets |
google.sheets.readonly | Read-only Sheets access |
google.drive | Google Drive files |
google.sa | Service account access |
Accessing Credentials
OAuth Integrations
python
1import os2import json3 4class App(BaseApp):5 async def setup(self, config):6 creds_json = os.environ.get("GOOGLE_OAUTH_CREDENTIALS")7 if creds_json:8 self.credentials = json.loads(creds_json)Service Account
python
1from google.oauth2 import service_account2 3sa_json = os.environ.get("GOOGLE_SA_CREDENTIALS")4if sa_json:5 self.credentials = service_account.Credentials.from_service_account_info(6 json.loads(sa_json)7 )Secrets vs Integrations
| Feature | Secrets | Integrations |
|---|---|---|
| User provides | Raw value (API key) | OAuth authorization |
| Refresh | Manual | Automatic |
| Scope control | None | Fine-grained |
| Best for | API keys | OAuth services |
Best Practices
- Request minimal scopes - use
readonlyif you only read - Clear descriptions - explain why access is needed
- Handle missing gracefully - check if optional integrations exist
- Test without - ensure app works without optional integrations
Next
→ Troubleshooting - Common issues and solutions