@devries-cameron20 / composio Mirror · read-only / commits / be47c5dcb
Fork 0

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 22, 03:15 UTC

docs: remove OAuth2 token import from importing-existing-connections

OAuth2 token import doesn't work — the backend transitions to INITIATED state and stays stuck. Removed the OAuth2 section and added a callout explaining it's not currently supported. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmitha Mallesh committed Mar 12, 2026 at 19:09 UTC be47c5dcbc3e35114bcfd22017660e9e13ca9996
1 file changed +9 -65
docs/content/docs/importing-existing-connections.mdx
+9 -65
@@ -1,91 +1,35 @@
1 ---
2 title: Importing existing connections
3 -description: Pass existing OAuth tokens, API keys, or other credentials into Composio so your users don't need to re-authenticate
3 +description: Pass existing API keys, bearer tokens, or other non-OAuth credentials into Composio so your users don't need to re-authenticate
4 keywords: [import connections, existing tokens, pass through credentials, bring your own tokens, no re-auth, pre-authenticated]
5 ---
6
7 -If your users have already authenticated with a service, say they connected their Google Drive through your app, or you already store their Slack OAuth tokens, you can pass those credentials directly into Composio. No re-authentication required.
7 +If your users have already authenticated with a service and you have their credentials (API keys, bearer tokens, etc.), you can pass those directly into Composio. No re-authentication required.
8
9 This is useful when:
10 -- Your app already has OAuth tokens for users (e.g., from a Slack or GitHub integration you built)
10 +- Your app already stores API keys or tokens for users
11 - You're adopting Composio and want to onboard existing users without disrupting them
12 -- Another platform (like Airtable or Retool) already holds credentials for your users' accounts
12 +- Another platform already holds credentials for your users' accounts
13
14 ## How it works
15
16 -Instead of redirecting users through an OAuth flow, you pass their existing tokens to `connectedAccounts.initiate()` using the `AuthScheme` helpers. Composio creates a connected account directly from those credentials.
16 +Instead of asking users to authenticate again, you pass their existing credentials to `connectedAccounts.initiate()` using the `AuthScheme` helpers. Composio creates a connected account directly from those credentials.
17
18 ```mermaid
19 graph LR
20 - A[Your existing tokens] --> B[connectedAccounts.initiate]
20 + A[Your existing credentials] --> B[connectedAccounts.initiate]
21 B --> C[Connected account in Composio]
22 C --> D[Execute tools immediately]
23 ```
24
25 ## Prerequisites
26
27 -1. **An auth config** for the toolkit you're importing into. See the note below on which type to use.
28 -2. **The existing credentials** for each user (access tokens, refresh tokens, API keys, etc.)
27 +1. **An auth config** for the toolkit you're importing into
28 +2. **The existing credentials** for each user (API keys, bearer tokens, username/password, etc.)
29 3. **A user ID** for each user, any string that uniquely identifies them in your system
30
31 <Callout type="warn">
32 -To import OAuth tokens, you must create a [custom auth config](/docs/using-custom-auth-configuration) using the same client ID and secret that originally issued them. You cannot import OAuth tokens into Composio's managed auth config. If you use managed auth, your users will need to re-authenticate through the standard OAuth flow. This does not apply to API keys, bearer tokens, or basic auth, which work with any auth config.
33 -</Callout>
34 -
35 -## OAuth2 tokens
36 -
37 -The most common case. You have access tokens (and ideally refresh tokens) from your existing OAuth integration.
38 -
39 -<Tabs groupId="language" items={['Python', 'TypeScript']} persist>
40 -<Tab value="Python">
41 -```python
42 -from composio import Composio
43 -from composio.types import auth_scheme
44 -
45 -composio = Composio(api_key="your-api-key")
46 -
47 -connection = composio.connected_accounts.initiate(
48 - user_id="user_123",
49 - auth_config_id="ac_your_auth_config",
50 - config=auth_scheme.oauth2({
51 - "access_token": "xoxb-existing-slack-token",
52 - "refresh_token": "xoxr-existing-refresh-token", # recommended
53 - "expires_in": 3600, # optional, seconds until expiry
54 - "scope": "chat:write,channels:read", # optional
55 - }),
56 -)
57 -
58 -connected_account = connection.wait_for_connection()
59 -print(f"Connected: {connected_account.id}")
60 -```
61 -</Tab>
62 -<Tab value="TypeScript">
63 -```typescript
64 -import { Composio, AuthScheme } from '@composio/core';
65 -
66 -const composio = new Composio({ apiKey: 'your-api-key' });
67 -
68 -const connection = await composio.connectedAccounts.initiate(
69 - 'user_123',
70 - 'ac_your_auth_config',
71 - {
72 - config: AuthScheme.OAuth2({
73 - access_token: 'xoxb-existing-slack-token',
74 - refresh_token: 'xoxr-existing-refresh-token', // recommended
75 - expires_in: 3600, // optional, seconds until expiry
76 - scope: 'chat:write,channels:read', // optional
77 - }),
78 - }
79 -);
80 -
81 -const connectedAccount = await connection.waitForConnection();
82 -console.log('Connected:', connectedAccount.id);
83 -```
84 -</Tab>
85 -</Tabs>
86 -
87 -<Callout type="info">
88 -Always include a `refresh_token` when possible. Combined with your auth config's client ID and secret, Composio will automatically refresh tokens when they expire, so the imported connection stays alive long-term.
32 +Importing existing OAuth tokens (access tokens, refresh tokens) is **not currently supported**. For OAuth-based services (Google, GitHub, Slack, etc.), users must authenticate through the standard [OAuth flow](/docs/tools-direct/authenticating-tools). This page covers importing non-OAuth credentials like API keys, bearer tokens, and basic auth.
33 </Callout>
34
35 ## API keys