> Documentation index: https://metorial.com/llms.txt. Every page is available as Markdown by adding .md to its URL.

# How per-user OAuth works for MCP tools
URL: https://metorial.com/docs/platform/guides/per-user-oauth

Each person connects their own accounts once in the Metorial portal, and every MCP tool call their agent makes runs with that person’s permissions.

---

With per-user OAuth, each person connects their own account for an integration, such as their own GitHub or Google account, through your Metorial portal. When their AI client calls a tool through Magic MCP, Metorial runs the call with that person's connection, so the agent can only see and change what the person could in the app. Nobody shares a service account, and no token is pasted into an AI client.

<PageIntro>
  <Learn>
    * How a tool call is tied to the person behind it
    * When to use per-user connections and when to use a shared one
    * How admins publish per-user integrations and how people connect them
  </Learn>
</PageIntro>

## How a call flows [#how-a-call-flows]

<Mermaid
  chart="sequenceDiagram
  participant U as Person
  participant C as AI client
  participant M as Metorial
  participant A as App (e.g. GitHub)
  U->>M: Signs in to the portal with company SSO
  U->>A: Connects their own account (OAuth)
  C->>M: Calls a tool through the Magic MCP URL
  M->>M: Checks the person's groups and tool filters
  M->>A: Calls the app with that person's credential
  A-->>M: Result, limited by the person's app permissions
  M-->>C: Result, recorded with the person's identity"
/>

Two layers limit every call. Metorial decides which integrations and tools the person may use, based on groups and [tool filters](/docs/platform/guides/tool-permissions). The app itself then applies the person's own permissions, so a person who cannot see a private repository in GitHub cannot see it through their agent either.

Credentials are stored in Metorial Vault and resolved at the gateway when a call is allowed. They are not passed to the model, the AI client, or the person. Organizations can encrypt them with their own AWS KMS keys.

## Per-user or shared connection [#per-user-or-shared-connection]

| Portal listing type | Who connects                            | Use it for                                                         |
| ------------------- | --------------------------------------- | ------------------------------------------------------------------ |
| User-configured     | Each person, with their own credentials | Apps where access differs per person: email, calendar, GitHub, CRM |
| Pre-configured      | An admin, with shared credentials       | Read-only reference data, or tools without per-person accounts     |

Prefer user-configured listings whenever the app has per-person accounts. A shared connection gives everyone the same access and makes logs show the same app identity for every call, even though Metorial still records which person made it.

## Publish a per-user integration [#publish-a-per-user-integration]

<Steps>
  <Step title="Add the integration to Workforce">
    In Workforce, open **Access**, **Integrations**, and select **Add Integration**. Choose **New Integration** to configure one, or **Existing Integration** to list one you already created.
  </Step>

  <Step title="Let each person connect">
    {/* VERIFY: the integration setup panel labels its connection choice "Users Connect" and "Shared Connection" by default (providerPanelFlow.tsx); confirm the Workforce flow uses the same labels. */}

    When you configure the integration, choose the option where users connect their own accounts (**Users Connect**) instead of a shared connection. This creates a user-configured listing.
  </Step>

  <Step title="Choose the groups">
    In the integration's **Access** section, select **Add Group**, set the group to **Allow**, and select **Save**.
  </Step>

  <Step title="Use your own OAuth app if needed">
    Metorial manages the OAuth apps by default. To control consent screens and scopes yourself, [create custom OAuth credentials](/docs/platform/integrations/create-custom-oauth-credentials) and use them in the integration.
  </Step>
</Steps>

Some apps, such as Google Workspace and Microsoft 365, need a workspace admin to approve the app before anyone can connect. The integration page tells you when that applies and can create a setup link to send to your admin.

## What people do [#what-people-do]

<Steps>
  <Step title="Connect accounts in the portal">
    Each person opens the portal, signs in with company SSO, goes to the integrations view, and connects the integrations they need. Each connection goes through the app's own sign-in.
  </Step>

  <Step title="Connect an AI client">
    They add the Magic MCP URL to their client and sign in. Metorial's consent screen lists the integrations they can use ("Select Integrations"), then lets them choose which tools the client may use for each one. **Tool Access** offers "Allow every tool, including ones added later, or pick specific tools."
  </Step>

  <Step title="Work as themselves">
    Every tool call now runs with that person's connection. Admins see the calls in Workforce under **Identity**, **Accounts**, on the person's **Operations** page.
  </Step>
</Steps>

## Agents that act for a person [#agents-that-act-for-a-person]

Agents connected through a person's Magic MCP URL act with that person's identity and never exceed what the person is allowed to do. For agents that need durable access of their own, Workforce has [agents](/docs/platform/workforce/inspect-agents) as separate actors, and [identity delegation](/docs/build/glossary#identity-delegation) lets one actor use another's credentials within a scoped, time-bound grant. To build the same flow into your own product, see [OAuth with the SDK](/docs/build/sdk/oauth).

## Troubleshooting [#troubleshooting]

### A tool call fails with an authentication error [#a-tool-call-fails-with-an-authentication-error]

The person's connection for that app has expired or been revoked. They reconnect the integration in the portal. Provider auth failures also appear in the dashboard's logs for admins.

### People cannot connect a Google Workspace or Microsoft 365 app [#people-cannot-connect-a-google-workspace-or-microsoft-365-app]

The app needs admin approval in that workspace. Create the setup link from the integration page and send it to the workspace admin.

### Two people get different results from the same tool [#two-people-get-different-results-from-the-same-tool]

That is expected. Each call uses the person's own account, so the app returns what that person can access.

## FAQ [#faq]

### Do employees share one service account for each app? [#do-employees-share-one-service-account-for-each-app]

No, not for user-configured integrations. Each person connects their own account, and the app applies their permissions to every call their agent makes.

### Can admins see or copy users' OAuth tokens? [#can-admins-see-or-copy-users-oauth-tokens]

Tokens are kept in Metorial Vault and resolved at the gateway when a call is allowed. They are not exposed to the model, the AI client, or the user.

### What happens when someone loses access in the app itself? [#what-happens-when-someone-loses-access-in-the-app-itself]

Their agent loses it too. Metorial uses the person's own credential, so the app refuses the call the same way it would refuse the person.

### What happens when someone leaves the company? [#what-happens-when-someone-leaves-the-company]

With [SCIM](/docs/platform/guides/sso-and-scim), deactivating them in your identity provider deprovisions their Metorial account and removes their groups. Revoke their app accounts in your normal offboarding as well.

To see which other MCP gateways document per-user OAuth, see [Which MCP gateways support per-user OAuth?](/docs/compare/per-user-oauth) in the [MCP gateway comparison](/docs/compare).

## Related pages [#related-pages]

<Cards columns="2">
  <Card title="Portals" icon="door-open" href="/docs/platform/workforce/portals">
    Publish user-configured and pre-configured integrations.
  </Card>

  <Card title="Custom OAuth credentials" icon="shield-check" href="/docs/platform/integrations/create-custom-oauth-credentials">
    Use an OAuth app you manage.
  </Card>

  <Card title="Audit MCP tool calls" icon="file-list-3" href="/docs/platform/guides/audit-logs">
    See which person made each call.
  </Card>

  <Card title="Tokenless auth on metorial.com" icon="external-link" href="https://metorial.com/features/tokenless-auth">
    Identity-based access instead of API keys.
  </Card>
</Cards>