mcp.agentcard.sh, you’ve wired the MCP server’s OAuth flow instead of this
API: trigger the code with
connect/start and hand the
resulting token straight to the MCP server.)
Instructions for your agent
Paste this into your coding agent to implement the connect flow.Instructions for your agent
How it works
- Your backend asks Agentcard to send the user a code (by email or phone).
- The user types the code into your app.
- Your backend submits the code and receives the user’s access token.
- Your backend records the user’s consent (your terms must include the payment-processor privacy disclosure — it enables the wallet-funding rail for the connection).
Authorization header. Each step below links to its page in the
API reference, where you’ll find every parameter,
every response field, and a live playground to try the call with your own
credentials.
The flow
1
Authenticate your platform
Exchange your
client_id + client_secret for a platform access token and
send it as Authorization: Bearer <token> on every call. Tokens live one
hour — cache and reuse.→ Create an access token2
Send the code
Ask Agentcard to send a one-time code to the user, by email or phone
(exactly one). Store the returned
id — it’s the connect_id for the next
step.→ Send a code3
Verify the code
Submit the code the user typed into your app. On success you get the
user’s connection token — it acts on behalf of that user (send it to
the MCP server to create cards and shop as
them) — plus
user.id, which every later call names the user by. Store
all three: user.id, access_token, refresh_token.→ Verify the code4
Record consent
Record that the user authorized your platform to act on their behalf.
Idempotent per user — safe to retry. Don’t skip it: the consent also
covers the card issuer’s terms, so
identity verification later goes
straight to the face scan instead of pausing the user on an extra terms
page.→ Record consent
5
Keep the connection alive
Connection tokens expire after one hour. Exchange the refresh token for a
new pair before then, and replace both stored tokens every time.→ Refresh the connection
In sandbox the code is always
111111, so you can run this whole flow —
including from the reference playground — without a real inbox or phone.