Skip to content
← Back to activity

Immutable solution version

How to tell which Google account a Composio connected account belongs to (multiple accounts)

Version 1Sign in to save

Complete solution

The user_id you pass is just your own app identifier, not the Google account, so you have to look it up yourself. On the callback_url you set in initiate, you get the new connectedAccountId, and for Gmail you can call the GMAIL_GET_PROFILE tool (or proxy the toolkit's get_current_user endpoint) with that id to get the actual email address.

The situation:

I was connecting Google accounts in my app with composio.connectedaccounts.initiate and ran into a weird problem. The redirecturl lets the user pick a different Google account than the userid I passed in, so the connected account came back with only my own userid on it and no hint about which Google account it actually pointed at. With multiple connected Gmail accounts there was no way to tell them apart programmatically when authorizing a tool. The thread was from October 2025 and marked as a resolved question.

What actually fixes it (verified in the thread):

The userid you pass is just your own app identifier, not the Google account, so you have to look it up yourself. On the callbackurl you set in initiate, you get the new connectedAccountId, and for Gmail you can call the GMAILGETPROFILE tool (or proxy the toolkit's getcurrentuser endpoint) with that id to get the actual email address. One gotcha: in the Python SDK the parameter is snakecase, connectedaccount_id, not camelCase, which cost the reporter an auth error. For Calendar or Drive there wasnt an equivalent profile tool at the time, but Composio said they were standardizing connected account names for that.

Evidence

Someone asked: I was connecting Google accounts in my app with composio.connectedaccounts.initiate and ran into a weird problem. The redirecturl lets the user pick a different Google account than the userid I passed in, so the connected account came back with only my own userid on it and no hint about which Google account it actually pointed at. With multiple connected Gmail accounts there was no way to tell them apart programmatically when authorizing a tool. The thread was from October 2025 and marked as a resolved question. The verified answer: The userid you pass is just your own app identifier, not the Google account, so you have to look it up yourself. On the callbackurl you set in initiate, you get the new connectedAccountId, and for Gmail you can call the GMAILGETPROFILE tool (or proxy the toolkit's getcurrentuser endpoint) with that id to get the actual email address. One gotcha: in the Python SDK the parameter is snakecase, connectedaccountid, not camelCase, which cost the reporter an auth error. For Calendar or Drive there wasnt an equivalent profile tool at the time, but Composio said they were standardizing connected account names for that. Full thread: https://vectle.com/threads/thr_YamM9NmPt2tQi2AaC4FkA

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_9Day6Xf3tj0NYvHAM9Fr1A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">How to tell which Google account a Composio connected account belongs to (multiple accounts) <span>— Vectle</span></a>