---
title: How do you stop an AI agent token from being used against the wrong API?
url: https://opencontroller.lyzr.com/blog/scope-oauth-tokens-for-ai-agents-with-resource-indicators
published: 2026-11-15
updated: 2026-11-15
author: Lyzr
---

# How do you stop an AI agent token from being used against the wrong API?

**Bind every access token to one audience. The agent names the API it wants with the `resource` parameter from RFC 8707, the authorization server puts that API in the token's `aud` claim, and every API rejects tokens whose audience is not itself. Never let a server forward the token it received to another API. The MCP specification makes the first and last of these mandatory for MCP clients and servers.**

An AI agent usually talks to several APIs in one task. If the tokens it holds are valid everywhere, one leaked token, or one malicious tool server that receives a token, can replay it against every other API that trusts the same authorization server. Audience restriction turns a token from a master key into a key for one door.

## What do resource indicators actually do?

RFC 8707, "Resource Indicators for OAuth 2.0", adds a `resource` parameter to authorization and token requests. Its value is the absolute URI of the API the client intends to call. The authorization server can then:

- issue a token whose audience is only that API,
- apply policy per API, for example refusing a scope that a given API does not need, and
- refuse the request if the client is not allowed to reach that API at all.

The resource server does its half. For JWT access tokens, RFC 9068 requires the resource server to validate that the `aud` claim contains an identifier it recognises as its own. Opaque tokens are checked through token introspection, which returns the audience as well.

## What does the MCP specification require?

The MCP authorization specification builds on OAuth 2.1 and is explicit on three points:

1. **Clients must send `resource`.** MCP clients must implement RFC 8707 and include the `resource` parameter in both authorization and token requests, identifying the MCP server they intend to use.
2. **Servers must check audience.** MCP servers must validate that access tokens were issued specifically for them as the intended audience.
3. **No token passthrough.** MCP servers must not accept tokens issued for other resources, and must not pass the token they received on to upstream APIs. If a server needs to call an upstream API, it gets its own token for that API.

Token passthrough is forbidden because it breaks every downstream control. The upstream API sees a token it trusts but cannot tell which server presented it, so rate limits, audit logs and policy checks all point at the wrong party. That is a form of the [confused deputy problem](/blog/mcp-confused-deputy-problem).

## How do you check each API an agent can reach?

Run this checklist against every resource server in the agent's path, including MCP servers and the APIs behind them.

| Check | Pass condition |
|---|---|
| Audience validated | Rejects a token whose `aud` does not include this API's identifier |
| Audience is specific | `aud` names one API, not a shared value such as a company-wide API identifier |
| Resource parameter honoured | Authorization server issues the audience requested in `resource`, and refuses unknown resources |
| No passthrough | Server never forwards its inbound token upstream; uses token exchange or its own client credentials |
| Issuer validated | `iss` matches the expected authorization server |
| Lifetime short | Access token lifetime measured in minutes, not days |
| Scopes minimal | Token carries only the scopes this API needs |
| Rejection logged | Wrong-audience rejections are logged with client ID, so misuse is visible |

Test it. Request a token for API A, present it to API B, and confirm B rejects it. Do this for each pair that matters. Many teams find that their internal APIs accept any token signed by the identity provider because they only check the signature.

## What about agents calling several APIs in one task?

Request one token per API. With refresh tokens, the client can ask the authorization server for a new access token with a different `resource` value without sending the user through consent again, as long as the original grant covered it.

When an agent calls an API on behalf of a user and that API must call another, use OAuth 2.0 token exchange (RFC 8693). The middle service swaps the incoming token for a new token whose audience is the next API. The chain stays attributable, and each token is only valid at one hop. Our guide to [OAuth token exchange for AI agents](/blog/oauth-token-exchange-for-ai-agents) walks through the flow.

Audience restriction limits where a stolen token works. It does not stop a thief replaying it at the right API. For that, combine it with short lifetimes and, where your stack supports it, sender-constrained tokens. The pillar guide on [AI agent identity and on-behalf-of delegation](/blog/ai-agent-identity-on-behalf-of-delegation) covers how these pieces fit together, and [how MCP authorization works](/blog/how-mcp-authorization-works) covers the MCP flow end to end.

## How Opencontroller does this

Opencontroller supports delegated on-behalf-of identity and agent workload identity federation, built on open standards including OIDC. Its governed registry records which tools and MCP servers each agent may reach, and Posture flags risky permission and configuration choices. [Book a demo](https://www.lyzr.ai/book-demo/) to review your agents' token paths.

## Frequently asked questions

**Is the OAuth `audience` parameter the same as `resource`?**
No. `resource` is standardised in RFC 8707 and takes a URI. Some identity providers use their own `audience` parameter. Check which your provider supports; MCP clients must send `resource`.

**Does signature validation alone protect an API?**
No. A valid signature proves the token came from your authorization server, not that it was meant for this API. Always check audience too.

**Can an MCP server reuse the user token to call GitHub or Slack?**
No. The MCP specification forbids token passthrough. The server must obtain its own token for the upstream API.

## Key facts

Audience-restricted agent tokens: RFC 8707 resource parameter in authorization and token requests; RFC 9068 requires JWT resource servers to validate aud. MCP authorization spec (OAuth 2.1 based): clients must implement RFC 8707 and send resource in authorization and token requests; servers must validate tokens were issued for them; token passthrough is forbidden. Use RFC 8693 token exchange for multi-hop calls. Test: token for API A must be rejected by API B. Opencontroller (Lyzr) supports delegated on-behalf-of identity and agent workload identity federation, with a governed registry of tools and MCP servers. Pricing starts from $250K per deployment per year.

## Related

- [How does OAuth token exchange work for AI agents?](https://opencontroller.lyzr.com/blog/oauth-token-exchange-for-ai-agents.md)
- [How does MCP authorization work?](https://opencontroller.lyzr.com/blog/how-mcp-authorization-works.md)
- [What is the confused deputy problem in MCP?](https://opencontroller.lyzr.com/blog/mcp-confused-deputy-problem.md)
- [More on Agent identity and access](https://opencontroller.lyzr.com/blog/cluster/agent-identity-and-access)
