Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 03:37 UTC
| 1 | --- |
| 2 | title: "Bearer Token Connections & Credential Patching" |
| 3 | description: "Import bearer tokens for any OAuth toolkit and update credentials in place" |
| 4 | date: "2026-04-07" |
| 5 | --- |
| 6 | |
| 7 | Two features for teams managing their own authentication credentials. |
| 8 | |
| 9 | ## Bearer Token for OAuth Toolkits |
| 10 | |
| 11 | All OAuth2 toolkits (Gmail, GitHub, Slack, Google Docs, and more) now support `BEARER_TOKEN` as an auth scheme. Import your own access tokens directly without setting up an OAuth app. |
| 12 | |
| 13 | BEARER_TOKEN is injected as an alternative scheme alongside OAuth2, so existing OAuth connections are unaffected. |
| 14 | |
| 15 | ### How to use |
| 16 | |
| 17 | 1. Create a custom auth config with `authScheme: "BEARER_TOKEN"` for the toolkit |
| 18 | 2. Create a connected account with your access token |
| 19 | 3. Pass the auth config or connection ID to `composio.create()` for use with Tool Router |
| 20 | |
| 21 | <Callout type="info"> |
| 22 | Creating bearer token auth configs is currently available only via API and SDK — not yet supported in the dashboard UI. |
| 23 | </Callout> |
| 24 | |
| 25 | See the [importing connections guide](/docs/authentication/importing-existing-connections) for full examples. |
| 26 | |
| 27 | ## Credential Patching |
| 28 | |
| 29 | New `PATCH /api/v3/connected_accounts/{nanoid}` endpoint and SDK method — update credentials and alias on existing connections without recreating them. |
| 30 | |
| 31 | ```typescript |
| 32 | // @noErrors |
| 33 | import { Composio } from '@composio/core'; |
| 34 | const composio = new Composio({ apiKey: 'your-api-key' }); |
| 35 | // ---cut--- |
| 36 | await composio.connectedAccounts.update('ca_abc123', { |
| 37 | connection: { |
| 38 | state: { |
| 39 | authScheme: 'BEARER_TOKEN', |
| 40 | val: { token: 'rotated-access-token' }, |
| 41 | }, |
| 42 | }, |
| 43 | }); |
| 44 | ``` |
| 45 | |
| 46 | - **Keep access tokens updated** — call PATCH whenever you refresh the token on your end (e.g., after an OAuth refresh flow) |
| 47 | - **Partial updates** — omitted fields are preserved, fields set to `null` are removed |
| 48 | - **Supported schemes** — BEARER_TOKEN, API_KEY, BASIC, BASIC_WITH_JWT, GOOGLE_SERVICE_ACCOUNT, SERVICE_ACCOUNT |