Beside the API reference, Put an agent on your site and Your chat app; this guide in Markdown.

Let people connect their accounts

Your agents act for the people who chat with them: on your own servers, and on other services, each time with the person's own account there. Each person connects an account once, the first time an agent needs it, and the connection is kept and renewed. This guide explains what a person meets as they connect, how your agents know your people, what your own MCP server does so your people can connect to it, and how to set it all up, in your console and at your identity provider.

The words this guide uses, as your console uses them:

What a person meets

A person connects an account on a connector that signs in with each user's own login (Add it as a connector, below): every call runs as the person who sent the turn, with their own account at the server. When a turn needs an account its person hasn't connected, the chat, on your site or in your chat app, pauses the turn and shows a card:

The card opens a window, which goes on to the server's sign-in, and says "Sign in in the window that opened. The agent goes on once you're connected." The person signs in there with their own account, and allows your agents' access where the server asks. The window then says their account is connected, and the agent goes on in the chat. "Not now" tells the agent they chose not to.

No password where they're signed in already. The window is the server's sign-in, in the person's own browser. When that browser is signed in there already, the sign-in asks for no password: at most it asks them to allow your agents' access, and the window goes on. Your people are signed in at your identity provider once they've signed in to your app through its page, so a connect to your own MCP server, which signs them in there, takes them straight through (Your own MCP server, below). When your app has a login form of its own, the first connect asks for their password once, and your identity provider's session covers the rest. At a third party's service, they sign in with their account there.

Only that window can finish the connect. The chat hands it a one-time binding as it opens it, and the sign-in finishes only with that binding (as RFC 9700 binds a flow to the browser that started it). A copy of its address, opened anywhere else, connects nothing: its page says "Open this from your chat", or that the link is no longer open. So someone sent a person's link can't connect their own account to that person's chat.

The binding needs the browser's Web Crypto (crypto.subtle), which a page served over plain http doesn't have. Serve the pages your chat is on over https. http://localhost works while you develop.

In your console's Playground, a connector on each user's own login connects your own account, as you test.

Through the API

When a turn of an API conversation needs an account, it pauses with a chat:connect interrupt. Its metadata.chat.url is a link for the person. Open it for that person alone, in a window of its own.

The link's page says whose chat it's for, by the name your app gave the person: "You're connecting an account to {person}'s chat with {agent}". It goes on when they choose Continue, and binds the sign-in to its own window, as the chat does. That page is the guard against the link reaching someone else, who would connect their own account to the person's chat. Keep the link as private as the conversation.

Once they've connected, the turn goes on by itself, and the conversation's stream shows it. There's nothing to resume.

A person's connections

The chat's menu lists a person's accounts under Connected accounts: the ones they connected, with the account each signed in as where its sign-in named it, and the ones the agent connects for them that they haven't yet. They connect one there with "Connect {connector}", or with "Reconnect {connector}" once it says "Sign in again next time", and can disconnect any. Your chat app's Settings lists them too, across agents.

Your server lists and removes them with your API key: GET /users/{id}/connections and DELETE /users/{id}/connections/{connector}, and the same under /visitors/{id}. GET /users/{id}/connectors lists the accounts an agent connects for the person, and POST /users/{id}/connections/{connector}/link gives your app a link for them to connect one from its own menu, through a page like the interrupt's. An agent that needs a connection removed asks for it again.

How your people are known

Every person who chats with your agents is a user or a visitor. Each has one record of their own, which holds their conversations, their files and the accounts they connected. No call for one person reaches another's.

A user is someone signed in to your app. They're known by the ID your app gives them, however they arrive:

One ID is one person. A token naming 4711 and X-User-ID: 4711 are the same user, with the same conversations and the same connected accounts. So every identity provider you add must name people by your app's IDs. Add token issuer says so when you add a second one: "Its people's IDs must be your app's IDs. If they're different people, they'd share conversations."

A token is checked before the person chats, and asked for again before the session it made ends. It's never stored. It also tells the agent the person's name, email, language and time zone, from the claims Embed sign-in reads them from: name, email, locale and zoneinfo, unless you choose others. Your server tells the agent the same through the API, with PUT /users/{id}.

A visitor isn't signed in. The embed makes an ID for each visitor the first time they chat, and their browser keeps it until 30 days after their last visit. Your server names a visitor through the API with X-Visitor-ID. A visitor connects no accounts of their own (Visitors don't connect accounts, below).

In your console, under Access → Single sign-on, Embed sign-in lists what your page's tokens are checked against: your identity provider, or a signing key. Add yours there, then your page's embed code. Each step is below; each identity provider's own is under Each provider's setup.

Your identity provider

  1. Under Embed sign-in, choose Add token issuer.
  2. Give one of these: your identity provider's domain, such as acme.us.auth0.com; its address (its issuer); its discovery address, ending in /.well-known/openid-configuration; or a token your app got from it. For one that publishes no discovery document, choose Enter endpoints manually and give its issuer and its JWKS URI.
  3. Its discovery document is read (OpenID Connect Discovery, else RFC 8414's authorization server metadata), and the line under the field says what was found. One that publishes no key to check your people's tokens with can't be added.
  4. A token you paste is read and checked, never kept. Its audience and claims fill in the form, and the line says whom it names, such as "This token checks: it names Ana Ruiz, user 4711."
  5. Give the audience: the app your page's tokens are for. A token is judged by its aud, which must hold it; a token with no aud, by its azp; one with neither, by its client_id. A token for another of your identity provider's apps opens no session, and an identity provider with no audience takes none.
  6. Check which claims hold the person's ID (sub unless you choose another), and their name, email, language and time zone.
  7. Choose Add token issuer.

Its document and keys are read again every day. Each token issuer in the list says the audience it takes, when it last accepted a token, and why it last refused one.

Embed code

Your page hands the chat each signed-in person's token in one of two ways:

The lines are for a page where the person is signed in. Where someone may not be, answer null for them: an error counts as no one too, but the chat warns about it in the browser's console each time it asks.

Add token-url to your chat's element, naming a path on your page's own origin, and keep the element's other attributes, such as mode="bubble":

<agent-chat agent="YOUR_AGENT_ID" token-url="/chat-token"></agent-chat>

The chat reads that path with your page's cookies, never cached: as it starts, before the session it made ends, and after a refusal.

Your server answers with a token your identity provider gave it, while it's fresh, or one it signs with a signing key (A signing key, below).

The token-url line names the agent by its ID, YOUR_AGENT_ID here: the agent's Embed in your console gives it with its own ID filled in. Put an agent on your site shows each form of the chat.

A signing key

For an app with no identity provider, such as one with sessions behind a cookie: choose Make a signing key under Access → Single sign-on, in Embed sign-in. Your server signs a token for each signed-in person with it, and your page names that server's path with token-url (Embed code, above). The server's lines, in five languages, are in Put an agent on your site.

A signing key signs your people in to your chat alone. A connector's server signs them in with an identity provider of its own, where each person connects once.

Your own MCP server

An MCP server of yours can act for each person with their own account. It signs people in with your identity provider, as MCP's authorization describes (its 2026-07-28 revision), and your agents connect each person to it the first time they need it. A person whose browser is still signed in at your identity provider, as it is once they've signed in to your app through its page, connects with no password (What a person meets, above). This section says what your server and your identity provider serve for that, and what a connect sends them. A third party's server is connected the same way, by what it serves.

Add it as a connector

Under Build → Connectors, choose Add a connector and give your server's MCP address. Your console asks the server what it offers, then one question: "How does the agent sign in to this server?" It offers the choices the server takes, in this order. Each user's own login comes first, chosen for you:

On a shared one, your agent's builder decides which actions ask the person first.

Below the choices, Advanced: OAuth client says which OAuth client the connector signs in with (Its OAuth client, below), and the scopes it asks for. Then turn the connector on in an agent's Connectors tab.

Its metadata

Your server names your identity provider as its authorization server in its protected-resource metadata (RFC 9728), as MCP's authorization asks:

Serve it at /.well-known/oauth-protected-resource followed by your MCP endpoint's path, such as https://mcp.acme.com/.well-known/oauth-protected-resource/mcp for https://mcp.acme.com/mcp, or at the root, https://mcp.acme.com/.well-known/oauth-protected-resource, and name it in your 401s (Its challenges, below). Your console reads it as you add the connector: it calls your server with no token, and follows your 401 to it.

Your identity provider's own metadata is read again at every connect, at RFC 8414's address (/.well-known/oauth-authorization-server) or OpenID Connect's (/.well-known/openid-configuration). Its issuer is the one your server names. A connect reads these in it:

It lists So a connect
S256 in code_challenge_methods_supported Proves its code with PKCE. MCP requires it: a connect refuses an identity provider that doesn't list it
client_id_metadata_document_supported, and none in token_endpoint_auth_methods_supported Can sign in with a client document (Its OAuth client, below)
registration_endpoint Can register a client (Its OAuth client, below)
openid in scopes_supported Asks for it, and for profile and email where each is listed, beside your server's scopes, so the connection shows the account's name. A connect that asks no scope of its own asks none of the three
offline_access in scopes_supported Asks for it, so the connection renews
authorization_response_iss_parameter_supported Refuses an answer that doesn't name its issuer (The sign-in, below)

An identity provider without S256 still checks your people's tokens for the embed, but a server that signs people in there can't act for each person: add it with an API key.

Its OAuth client

Every connect needs an OAuth client at your identity provider: the app your people allow there. A connector signs in with the first of these it has:

  1. Its own OAuth client, one you make at your identity provider for your agents. Enter it under Advanced: OAuth client as you add the connector, where it's "Optional: registered with the provider for this connector alone, and used before any other.", or later in the connector's Settings. Advanced: OAuth client then names it: "Its own OAuth client, registered with the provider." One client can serve every connector at one identity provider: enter it on each.
  2. A client document (OAuth Client ID Metadata Documents), where your identity provider lists client_id_metadata_document_supported and takes a client with no secret, none among its token_endpoint_auth_methods_supported: a document's client is public. It carries your name and icon, as your console holds them, and both redirect addresses (below). Its address is on your console's host: an identity provider that takes documents only from the domains it trusts must trust that one.
  3. A registration (Dynamic Client Registration, RFC 7591), where your identity provider offers one: a client named for you, registered at the first connect and kept. MCP keeps registration for identity providers that take no client documents, and most identity providers refuse it until you turn it on there.
  4. None: Advanced: OAuth client says "None: enter your OAuth client below.", and says the client is needed, "so enter your OAuth client here". The connector isn't added without one: "that server's login needs an OAuth client registered with its provider: enter its client ID and secret under Advanced: OAuth client".

A client you make allows the authorization code grant with PKCE, refresh tokens, both redirect addresses and the scopes your servers ask for, with offline_access, and openid, profile and email where your identity provider lists them. Usually it's a confidential client, with a secret; one with no secret is public. Each identity provider's steps are under Each provider's setup. A new client means everyone signs in again: the connections made through the old one go.

The redirect addresses

A connect comes back to one of two addresses, which a client you make allows as its redirect URIs. Advanced: OAuth client shows both, to copy: "Register both redirect URIs with the provider: the console's, and the API's, where your people connect from their chats."

A connector on one shared account comes back to your console's alone. A client document and a registration list both by themselves.

The sign-in

Each connect is OAuth's authorization code flow, as MCP's authorization has it:

A connection keeps its tokens, which no one is shown and no agent reads. It's renewed with its refresh token before it ends, and when your server refuses its token. When the person disconnects, its tokens are revoked where your identity provider offers revocation.

Its challenges

Your server takes each person's token in Authorization: Bearer …, and says why it refuses one in WWW-Authenticate, as MCP's authorization has it:

Each provider's setup

Each identity provider's own setup, in its own console's words: what Embed sign-in takes from it and your embed code, for your people's tokens; then, for your MCP servers that sign people in there, how a connect gets its OAuth client. Where a provider takes neither a client document nor a registration, make one client there for your agents, as below, and enter it as each such connector's own, under Advanced: OAuth client. Both redirect URIs are the two addresses in The redirect addresses, above.

Auth0

Give Embed sign-in your Auth0 domain, such as acme.us.auth0.com, or your custom domain. Its audience is your API's Identifier, under Applications → APIs. Give your page's Auth0 client the same audience, so getTokenSilently() answers a signed token rather than an opaque one.

Your embed code, which renews the token when it's due:

const chat = document.querySelector('agent-chat')
chat.getUserToken = () => auth0.getTokenSilently()

Auth0 refuses an app that registers itself until you turn on Dynamic Client Registration, under Settings → Advanced, which is off at first. Make a client for your agents instead, in the Auth0 Dashboard:

  1. Go to Applications → Applications and choose Create Application.
  2. Name it (Agents, say), choose Regular Web Applications, and create it.
  3. On its Settings tab, paste both redirect URIs into Allowed Callback URLs, and save.
  4. Under Advanced Settings → Grant Types, keep Authorization Code and Refresh Token on.
  5. If your servers' tokens are for an Auth0 API, turn on Allow Offline Access in Applications → APIs → that API → Settings, so connections renew.
  6. Copy the Client ID and Client Secret from its Settings tab into each connector's Advanced: OAuth client.

Okta

Give Embed sign-in your custom authorization server's address, such as https://acme.okta.com/oauth2/default. Custom authorization servers come with Okta's API Access Management. Your org's own, https://acme.okta.com, won't do: its access tokens are for Okta's own APIs, and others can't check them. Its audience is the authorization server's, under Security → API → Authorization Servers: api://default for the default one.

Embed sign-in reads the person's ID from uid in your page's tokens, and from sub in ID tokens. Both are the Okta user ID, which never changes; an Okta access token's sub is the person's login, which can. For an identity provider you add now, there's nothing to set up for it. One added before Embed sign-in filled these in keeps sub, the login, as the person's ID; adding it again fills them in, and names its people anew, by their user ID.

Your embed code, which renews the token when it's due:

const chat = document.querySelector('agent-chat')
chat.getUserToken = () => oktaAuth.getOrRenewAccessToken()

Okta registers an app only for a caller with an API token, which your agents don't have. Make a client for your agents, in the Okta Admin Console:

  1. Go to Applications → Applications and choose Create App Integration.
  2. Choose OIDC - OpenID Connect and Web Application, then Next.
  3. Name it, tick Refresh Token beside Authorization Code, and paste both redirect URIs into Sign-in redirect URIs.
  4. Under Assignments, choose who may use it, and save.
  5. In Security → API → Authorization Servers, open the server your servers use, and check that an access policy rule lets this client in, with the scopes your servers ask for and openid, profile and email: a rule applies only when it allows every scope a connect asks.
  6. Copy the Client ID and Client secret from its General tab into each connector's Advanced: OAuth client.

Entra ID

Give Embed sign-in your own tenant's address: https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0. The common and organizations addresses name no one issuer, so Embed sign-in refuses them.

In your API's app registration, open Manifest and set requestedAccessTokenVersion to 2 (accessTokenAcceptedVersion in the older manifest). Its access tokens then name the issuer Embed sign-in read, ending in /v2.0, and hold your API's Application (client) ID as their audience. Give Embed sign-in that ID as the audience.

Embed sign-in reads the person's ID from oid, and fills that in itself: Entra ID's sub is different in each app, while oid is the same person in every app of your tenant.

Your embed code, with your API's scope. MSAL renews the token when it's due. It needs the signed-in account set as its active account (msal.setActiveAccount), to know whose token to get:

// Your API's scope, as Expose an API shows it in its app registration
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const result = await msal.acquireTokenSilent({
    scopes: ['YOUR_API_SCOPE'],
  })
  return result.accessToken
}

Entra ID can be your identity provider for the embed, but your MCP servers can't sign people in through it: its discovery document doesn't list PKCE's S256, which MCP requires. A server that signs people in there can't act for each person: add it with an API key.

Keycloak

Give Embed sign-in your realm's address, such as https://sso.acme.com/realms/acme. Its audience is the client an Audience mapper puts in your tokens, set in your app client's dedicated client scope.

Your embed code, which renews the token first when it ends within 30 seconds:

const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  await keycloak.updateToken(30)
  return keycloak.token
}

Keycloak's Trusted Hosts policy refuses an app that registers itself, unless its request comes from a host you trust. Make a client for your agents instead, in the Keycloak Admin Console:

  1. Choose your realm, go to Clients and choose Create client.
  2. Keep OpenID Connect, give it a Client ID (agents, say), and Next.
  3. Turn on Client authentication, keep Standard flow on, and Next.
  4. Paste both redirect URIs into Valid redirect URIs, and save.
  5. On its Client scopes tab, choose Add client scope, and add the scopes your servers ask for as Optional. Create any that are missing under Client scopes in the menu. Keycloak refuses a scope its client wasn't given, so keep profile and email, which a new client has: a connect asks them.
  6. Copy the Client ID, and the Client Secret from its Credentials tab, into each connector's Advanced: OAuth client.

Cognito

Give Embed sign-in your user pool's address, such as https://cognito-idp.us-east-1.amazonaws.com/us-east-1_EXAMPLE. Its audience is your app client's ID, which Cognito's ID tokens hold. Its access tokens hold no audience, so your page hands over the ID token.

Your embed code, here with Amplify, which renews the session's tokens when they're due:

// With Amplify: import { fetchAuthSession } from 'aws-amplify/auth'
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { tokens } = await fetchAuthSession()
  return tokens?.idToken?.toString()
}

Cognito can be your identity provider for the embed, but your MCP servers can't sign people in through it: its discovery document doesn't list PKCE's S256, which MCP requires. A server that signs people in there can't act for each person: add it with an API key.

Clerk

Give Embed sign-in your Frontend API's address, such as https://clerk.acme.com, or https://NAME.clerk.accounts.dev while you develop. Its audience is your site's address, its origin, such as https://acme.com: Clerk's session tokens carry no aud, and name the site that asked for them in azp. With a JWT template that adds an aud, such as Convex's convex, its audience is what that aud holds, since a token with an aud is judged by it alone. Its session tokens last 60 seconds, and the chat asks for a new one before each ends.

Your embed code:

const chat = document.querySelector('agent-chat')
chat.getUserToken = () => Clerk.session.getToken()

Clerk refuses an app that registers itself until you turn on Publish DCR support, under OAuth applications → Settings, which is off at first. Make a client for your agents instead, in the Clerk Dashboard:

  1. Go to OAuth applications and add an OAuth application.
  2. Name it and choose the scopes your servers ask for, offline_access, and openid, profile and email.
  3. Copy its Client Secret now: Clerk shows it once.
  4. On its page, add both redirect URIs as Redirect URIs, and keep Public off.
  5. Copy the Client ID from its Application credentials, and the secret, into each connector's Advanced: OAuth client.

Supabase

Give Embed sign-in https://PROJECT_REF.supabase.co/auth/v1, with your project's reference. Its tokens are checked against the keys your project publishes, which it does once it signs with asymmetric JWT signing keys. A project still on the legacy shared secret publishes none, so it can't be added. Its audience is authenticated, which every Supabase session token holds.

Your embed code:

const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => {
  const { data } = await supabase.auth.getSession()
  return data.session.access_token
}

Supabase refuses an app that registers itself until you turn on dynamic client registration, under Authentication → OAuth Server, which is off at first. Make a client for your agents instead, in your Supabase project's dashboard:

  1. Turn on the OAuth server in Authentication → OAuth Server.
  2. Go to Authentication → OAuth Apps and choose Add a new client.
  3. Name it, add both redirect URIs as Redirect URIs, choose Confidential as its Client type, and create it.
  4. Copy the Client ID and Client Secret into each connector's Advanced: OAuth client: the secret is shown once.

Firebase

Give Embed sign-in https://securetoken.google.com/PROJECT_ID, with your project's ID. Its audience is that ID, which every Firebase ID token holds.

Your embed code:

const chat = document.querySelector('agent-chat')
chat.getUserToken = () => firebase.auth().currentUser.getIdToken()

Firebase signs no other apps in, so your MCP servers can't sign people in through it.

Logto

Give Embed sign-in your Logto tenant's address, such as https://acme.logto.app/oidc, or just acme.logto.app. A custom domain is an issuer of its own: use one host everywhere, in Embed sign-in, in your page's Logto client and in your MCP servers' metadata. Its audience is your API resource's indicator, the API identifier your page asks Logto for a token for. Logto signs with ES384 by default, which Embed sign-in reads.

Logto's access tokens carry no name or email, so the agents don't know a person's name until they're told it: add name and email to your access tokens as custom token claims in Logto, or have your server tell the agents through PUT /users/{id}.

Your embed code:

// Your API resource’s indicator, as Logto’s API resources show it
const chat = document.querySelector('agent-chat')
chat.getUserToken = () =>
  logtoClient.getAccessToken('https://api.acme.com')

Logto doesn't let apps register themselves. Make a client for your agents, in the Logto Console:

  1. Go to Applications and choose Create application.
  2. Choose Traditional web, name it (Agents, say), and create it.
  3. On its page, paste both redirect URIs into Redirect URIs, and save changes.
  4. For each MCP server your connectors reach, go to API resources and create one whose API identifier is the server's resource exactly, as its metadata names it, with the permissions your server asks for.
  5. In Roles, give the people who use your agents a role holding those permissions: Logto puts a permission in a token only for someone whose role holds it.
  6. Copy the App ID and App secret from its page into each connector's Advanced: OAuth client.

Logto gives a refresh token only when a sign-in asks for consent, so a connect at Logto asks for it (prompt=consent). Logto shows its own apps, such as a Traditional web one, no consent screen, so your people still go straight through.

Google

Google signs people in to its own services, and to servers that sign people in with Google accounts. A connect at Google asks for access offline, with the person's consent (access_type=offline, prompt=consent): Google gives a refresh token only then. So each time a person connects, Google asks them to allow your agents' access, even when they're signed in to Google already.

Google lets no app register itself. Make a client for your agents in the Google Cloud console: an OAuth client of the Web application type, with both redirect URIs as its Authorized redirect URIs, and its consent screen set up as Google asks. Copy its Client ID and Client secret into each connector's Advanced: OAuth client.

Any OpenID Connect identity provider

Give Embed sign-in its domain, or its issuer's address. Its audience is what your tokens' aud holds: often your API's identifier, or your app's client ID.

Your embed code, here with oidc-client-ts:

// Any OpenID Connect identity provider: its ID or access token,
// here with oidc-client-ts
const chat = document.querySelector('agent-chat')
chat.getUserToken = async () => (await userManager.getUser())?.id_token

Many identity providers refuse an app that registers itself until you turn that on, and take no client documents. Where yours takes neither, make a client for your agents in its admin console:

  1. Register a new web application: a confidential client, with a client secret.
  2. Add both redirect URIs as its redirect URIs, which some consoles call callback URLs.
  3. Allow the authorization code grant with PKCE (S256), refresh tokens with offline_access, the scopes your servers ask for, and openid, profile and email.
  4. Copy its client ID and secret into each connector's Advanced: OAuth client.

Visitors don't connect accounts

Only a user connects their own accounts. A visitor isn't signed in to your app, so nothing vouches for who they are: an account connected in their chat would belong to a browser, not to a person your app knows, and no one could find it again or protect it. So a visitor's turns offer none of the tools on a connector on each user's own login, and their chat's menu offers no account to connect. An agent anyone may use, which its Share calls "Anyone, including visitors", gives visitors its other tools.

To let someone connect their own accounts, sign them in to your app: the chat then knows them as a user (How your people are known, above).

The connections a visitor still has stay theirs until they end: 30 days after the visitor's last visit, or when your server erases the visitor (DELETE /visitors/{id}). Their chat's menu lists them, says when they end, and lets the visitor disconnect any. Your server lists and removes them with GET /visitors/{id}/connections and DELETE /visitors/{id}/connections/{connector}.

What goes wrong

In the chat

What a person may see while they connect, why, and what changes it. Each refusal is a problem the API answers too, and its code links its page.

In your setup