https://linen.dev logo
OAUTH2 flow issue after latest upgrade
# đŸ–„â”‚support-forum
o
What’s Actually Happening After I complete the Google OAuth flow, the popup is redirected to https://platform.composio.dev/auth instead of my app’s callback URL. The Composio platform login page at https://platform.composio.dev/auth is a generic login/landing page, not an OAuth callback handler. What the Logs Show The backend successfully creates a Gmail connection and receives a redirectUrl like https://backend.composio.dev/api/v3/s/18XQAzY1. This redirectUrl is what you are being sent to in the popup after the connection is initiated. I am not being redirected to my app’s /composio/oauth/callback route, even though I am passing it in both configuration.redirectUrl and connectionParams.redirectUrl. The Composio API is ignoring my redirectUrl and instead returning its own internal redirect URL. Why This Is Happening Composio’s v3 API is not honoring the redirectUrl parameter I am sending in the connection creation payload. Instead, it is returning a redirectUrl that points to its own backend, which then (after the OAuth flow) sends me to the platform login page. This is likely a change in the Composio v3 platform’s OAuth flow, and is not something I can fix from my side by changing the payload.
c
Hi Joe, Could you share you code snippet? It will help us understand the Issue and provide a resolution faster.
o
// Connection Creation Payload (Gmail) const connectionPayload = { appId: 'gmail', entityId: 'joe@apptivity.co', configuration: { email: 'joe@apptivity.co', timezone: 'America/Los_Angeles', redirectUrl: 'http://localhost:3000/composio/oauth/callback', // ← Custom callback URL scopes: [ 'https://www.googleapis.com/auth/gmail.modify', 'https://www.googleapis.com/auth/gmail.send', 'https://www.googleapis.com/auth/gmail.compose', 'https://www.googleapis.com/auth/gmail.labels', 'https://www.googleapis.com/auth/gmail.readonly' ] }, connectionParams: { redirectUrl: 'http://localhost:3000/composio/oauth/callback' // ← Also tried here }, metadata: { userId: 'e86c37f3-4228-4a16-9d8c-708a1e5a2301', service: 'composio', type: 'gmail-connection' } } // API Call const result = await composioApiCall('/connections', { method: 'POST', body: JSON.stringify(connectionPayload) }) // Response from Composio v3 API console.log('Composio Response:', { success: result.success, redirectUrl: result.data?.redirectUrl, // ← Returns: 'https://backend.composio.dev/api/v3/s/18XQAzY1' connectedAccountId: result.data?.connectedAccountId })
c
Just to confirm — Are you referring to this API: ? Let me know if you are referring to a different endpoint!
o
Yes I am using that endpoint (was not initially..was using the v1/v2 endpoint). I changed to use the v3 endpoint but the same issue happens: Issue: The redirectUrl parameter in the connection creation payload is not being honored. Instead of redirecting to our custom callback URL, Composio always redirects to https://platform.composio.dev/auth after OAuth completion. Expected Behavior: User completes Google OAuth Composio redirects to our custom callback URL (e.g., http://localhost:3000/composio/oauth/callback) Our callback page handles the completion and closes the popup Actual Behavior: User completes Google OAuth Composio redirects to https://platform.composio.dev/auth User sees Composio's platform login page instead of our callback
u
Let me share CUrl req as a reference to help you out. 1. Create an Auth Config with the configuration. 2. Initiate a connection using the Auth Config. → This is where you can specify the callback Url. 1. Example Auth Config:
Copy code
curl -X POST https://backend.composio.dev/api/v3/auth_configs \
     -H "x-api-key: <composio-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
  "toolkit": {
    "slug": "gmail"
  },
  "auth_config": {
    "type": "use_custom_auth",
    "credentials": {
      "client_id": "<id>",
      "client_secret": "<secret>",
      "oauth_redirect_uri": "https://backend.composio.dev/api/v1/auth-apps/add"
    },
    "authScheme": "OAUTH2"
  }
}'
2. Initiating a connection(Pass your existing Auth Config Id):
Copy code
curl -X POST https://backend.composio.dev/api/v3/connected_accounts \
     -H "x-api-key: <cmposio-api-key>" \
     -H "Content-Type: application/json" \
     -d '{
  "auth_config": {
    "id": "ac_xxx"
  },
  "connection": {
    "callback_url": "<ADD Your Callback Url here>",  //add it here
    "user_id": "test-callback"
  }
}'
c
Try adding the Callback Url while Initiating the connection and let me know if that works for you.
5 Views