@devries-cameron20 / composio Mirror · read-only / commits / 680ae0132
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(sdk): document OAuth token auto-detection and status override behavior

Add JSDoc/docstrings to OAuth2 and OAuth1 helpers in both TypeScript and Python explaining when status defaults to ACTIVE vs INITIALIZING and how to override with an explicit status param.

jkomyno committed Mar 13, 2026 at 02:27 UTC 680ae0132882a45ec0539c963a605688c6a5edc0
2 files changed +18 -2
python/composio/core/models/connected_accounts.py
+10
@@ -93,6 +93,11 @@ class AuthScheme:
93 ) -> connected_account_create_params.ConnectionState:
94 """
95 Create a new connected account using OAuth 1.0.
96 +
97 + When both ``oauth_token`` and ``oauth_token_secret`` are provided,
98 + status defaults to ACTIVE (token import). When either is omitted,
99 + status defaults to INITIALIZING (redirect-based OAuth flow).
100 + Pass an explicit ``status`` in options to override.
101 """
102 has_tokens = bool(
103 options.get("oauth_token") # type: ignore[union-attr]
@@ -116,6 +121,11 @@ class AuthScheme:
121 ) -> connected_account_create_params.ConnectionState:
122 """
123 Create a new connected account using OAuth 2.0.
124 +
125 + When ``access_token`` is provided, status defaults to ACTIVE
126 + (token import). When omitted, status defaults to INITIALIZING
127 + (redirect-based OAuth flow). Pass an explicit ``status`` in
128 + options to override.
129 """
130 has_token = bool(options.get("access_token")) # type: ignore[union-attr]
131 status = "ACTIVE" if has_token else "INITIALIZING"
ts/packages/core/src/models/AuthScheme.ts
+8 -2
@@ -7,7 +7,10 @@ import {
7
8 export class AuthScheme {
9 /**
10 - * Creates a ConnectionData object for OAuth2 authentication
10 + * Creates a ConnectionData object for OAuth2 authentication.
11 + * When `access_token` is provided, status defaults to ACTIVE (token import).
12 + * When omitted, status defaults to INITIALIZING (redirect-based OAuth flow).
13 + * Pass an explicit `status` in params to override the auto-detected default.
14 * @param params The OAuth2 parameters
15 * @returns ConnectionData object
16 */
@@ -44,7 +47,10 @@ export class AuthScheme {
47 }
48
49 /**
47 - * Creates a ConnectionData object for OAuth1 authentication
50 + * Creates a ConnectionData object for OAuth1 authentication.
51 + * When both `oauth_token` and `oauth_token_secret` are provided, status defaults to ACTIVE (token import).
52 + * When either is omitted, status defaults to INITIALIZING (redirect-based OAuth flow).
53 + * Pass an explicit `status` in params to override the auto-detected default.
54 * @param params The OAuth1 parameters
55 * @returns ConnectionData object
56 */