@devries-cameron20 / composio-1 / commits / 05ce9c63a
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.

Fix: Make OAuth Params optional in creation connected accounts programmatically (#1870)

Co-authored-by: Mayank Thakur <124957319+mayank2130@users.noreply.github.com>

Musthaq Ahamad committed Aug 26, 2025 at 11:02 UTC 05ce9c63ae4727ec8fdd38c0702522a4eb13f41a
5 files changed +45 -4
.changeset/whole-papayas-nail.md new
+5
@@ -0,0 +1,5 @@
1 +---
2 +'@composio/core': patch
3 +---
4 +
5 +Fix make access token and token type optional in oauth scheme
fern/pages/src/tool-calling/authenticating-tools.mdx
+29
@@ -165,6 +165,35 @@ const connRequest = await composio.connectedAccounts.initiate(
165 </CodeGroup>
166
167
168 +### Services with Additional Parameters
169 +
170 +Some services like Zendesk require additional parameters such as `subdomain`:
171 +
172 +<CodeGroup>
173 +```python
174 +# For Zendesk - include subdomain
175 +connection_request = composio.connected_accounts.initiate(
176 + user_id=user_id,
177 + auth_config_id=auth_config_id,
178 + config=auth_scheme.oauth2(subdomain="mycompany") # For mycompany.zendesk.com
179 +)
180 +```
181 +
182 +```typescript
183 +import { AuthScheme } from '@composio/core';
184 +// For Zendesk - include subdomain
185 +const connRequest = await composio.connectedAccounts.initiate(
186 + userId,
187 + authConfigId,
188 + {
189 + config: AuthScheme.OAuth2({
190 + subdomain: 'mycompany'
191 + })
192 + }
193 +);
194 +```
195 +</CodeGroup>
196 +
197 ### API Key Connections
198
199 For API key authentication, you can either *collect API keys from each user* or *use your own API key* for all users. Popular Toolkits that use API Keys include Stripe, Perplexity etc.
ts/docs/api/connected-accounts.md
+7
@@ -41,6 +41,13 @@ const oauthConnection = await composio.connectedAccounts.initiate('user_123', 'a
41 callbackUrl: 'https://myapp.com/auth/callback',
42 });
43
44 +// For OAuth configs requiring additional parameters (e.g., Zendesk, PostHog)
45 +const zendeskConnection = await composio.connectedAccounts.initiate('user_123', 'zendesk_auth_config', {
46 + config: AuthScheme.OAuth2({
47 + subdomain: "yout_subdomain_here"
48 + })
49 +});
50 +
51 // For API Key based auth configs (requires additional parameters)
52 const apiKeyConnection = await composio.connectedAccounts.initiate('user_123', 'auth_config_456', {
53 config: AuthScheme.ApiKey({
ts/packages/core/src/models/AuthScheme.ts
+3 -3
@@ -13,8 +13,8 @@ export class AuthScheme {
13 */
14 static OAuth2(
15 params: BaseConnectionFields & {
16 - access_token: string;
17 - token_type: string;
16 + access_token?: string;
17 + token_type?: string;
18 id_token?: string;
19 refresh_token?: string;
20 expires_in?: number;
@@ -49,7 +49,7 @@ export class AuthScheme {
49 */
50 static OAuth1(
51 params: BaseConnectionFields & {
52 - oauth_token: string;
52 + oauth_token?: string;
53 consumer_key?: string;
54 redirectUrl?: string;
55 callback_url?: string;
ts/packages/core/src/models/ConnectedAccounts.ts
+1 -1
@@ -160,7 +160,7 @@ export class ConnectedAccounts {
160 });
161 if (connectedAccount.items.length > 0 && !options?.allowMultiple) {
162 throw new ComposioMultipleConnectedAccountsError(
163 - `Multiple connected accounts found for user ${userId} in auth config ${authConfigId}`
163 + `Multiple connected accounts found for user ${userId} in auth config ${authConfigId}. Please use the allowMultiple option to allow multiple connected accounts.`
164 );
165 } else if (connectedAccount.items.length > 0) {
166 logger.warn(