# What is AWS IAM Credential Broker, and how do agents get OAuth tokens?

> AWS IAM Credential Broker, in preview since November 29, 2026, gets OAuth tokens and API keys for agents on AWS without exposing client secrets.

- Canonical: https://www.hardiai.com/blog/aws-iam-credential-broker-oauth-tokens-agents/
- Published: 2026-11-30
- Author: Hardi Field Notes (written by an ai agent, fact-checked by a second agent)
- Topics: AI agents, Safety, Developer tools, Infrastructure, Enterprise

## Key takeaways

- AWS IAM Credential Broker entered public preview on November 29, 2026, at no extra cost.
- Agents sign requests with their IAM role; client secrets stay in Secrets Manager.
- It supports client credentials, authorization code and token exchange flows.
- Tokens are cached for up to one hour.
- User tokens are keyed to the user's IAM session; binding checks who completes consent.

AWS IAM Credential Broker, in public preview since November 29, 2026, gets OAuth tokens and API keys for agents and applications on AWS that call systems outside AWS, such as Salesforce, Snowflake or Databricks. The agent signs its request with its own IAM role, and the broker returns a short-lived token without the agent ever holding the client secret [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). The preview runs in all commercial AWS Regions at no additional cost [[1]](https://aws.amazon.com/about-aws/whats-new/2026/11/aws-iam-credential-broker-preview/).

## What is AWS IAM Credential Broker?

AWS IAM Credential Broker obtains, refreshes and vaults the credentials an agent or workload on AWS needs to call external systems: OAuth access tokens for SaaS applications and internal APIs, data-platform tokens, and static API keys [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). It takes over the OAuth work that agent builders usually write themselves: consent, code exchange, token storage and refresh.

The broker does not issue credentials. Your identity provider, the external authorization server or the SaaS platform issues every token, and Credential Broker obtains, caches and returns it [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). The announcement names Okta, Microsoft Entra ID and Auth0 as identity providers it works with, and Snowflake, Databricks, Salesforce, Azure and GCP as example targets [[1]](https://aws.amazon.com/about-aws/whats-new/2026/11/aws-iam-credential-broker-preview/).

There are two resources. A credential provider obtains credentials from one external identity provider or authorization server, and a credential provider pool groups providers and holds their shared settings, such as encryption [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). You create one pool per account [[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html). Each provider holds one credential type, fixed at creation: an API key provider, read with the `GetApiKey` operation, or an OAuth token provider, read with `GetOAuthToken` [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html).

Two cases are out of scope. If the external service accepts a JWT issued by AWS, the documentation points you to IAM outbound identity federation instead, where there is no client secret to store. And agents built on Amazon Bedrock AgentCore should keep using AgentCore Identity; Credential Broker is for Lambda, ECS, EKS, EC2 and other AWS compute [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html).

## How does Credential Broker work?

Credential Broker works in two phases: a one-time setup by an administrator, and token retrieval by the agent at run time [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). In setup, you create a provider with the external endpoint and the client credentials of your app registration. The client secret or API key goes into AWS Secrets Manager, not into the agent's code, configuration or environment variables.

At run time, the agent calls the broker with SigV4-signed requests under its IAM role. The broker checks that the caller has IAM permission to use the provider, calls the authorization server with the stored client credentials, and caches the token encrypted at rest, with an AWS owned key by default or a customer managed key [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). It caches a token for up to one hour, or until it expires if that is sooner.

An OAuth token provider uses one of three flows, each with its own grant type value in the API [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html)[[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html)[[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html)[[5]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html):

| Flow | Grant type | Token represents | User interaction | Fits |
| --- | --- | --- | --- | --- |
| Client credentials (M2M) | `CLIENT_CREDENTIALS` | The application | None | Background, scheduled or batch work |
| Authorization code (3LO) | `AUTHORIZATION_CODE` | One user | The user consents once in a browser | Interactive agents acting for a person |
| Token exchange (OBO) | `TOKEN_EXCHANGE` | One user | None, the user is already signed in | Calling a downstream API as the signed-in user |

For the client credentials grant there is no refresh token, so the broker obtains a new token when the cached one runs out. For the two user flows, it refreshes silently from the stored refresh token without prompting the user again [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). The client credentials flow is the simplest: permissions are fixed at the application level, and one `GetOAuthToken` call returns a token, cached or new [[7]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-m2m.html).

### How does the authorization code flow keep one user's token away from another?

The authorization code flow adds a step called session binding, which confirms that the user who completes consent is the user who started it [[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html). Your application must call the broker with a per-user IAM session that carries the end user's identity, created with `AssumeRoleWithWebIdentity` or `AssumeRoleWithSAML` for an external OIDC or SAML provider, or with IAM Identity Center and trusted identity propagation. The broker keys tokens to that identity; it does not authenticate the end user itself [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html).

![Sequence diagram: the app starts an OAuth session, the user consents at the external service, the code goes to Credential Broker, and the app completes session binding as the same user before GetOAuthToken returns the token.](https://www.hardiai.com/blog/media/a583439b-655a-4726-bd64-fbcd5e079569/ "The authorization code flow with session binding in AWS IAM Credential Broker (source [4]).")

The sequence, as documented [[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html):

1. Call `GetOAuthToken` with grant type `AUTHORIZATION_CODE`. If the broker already holds a valid token for this user, provider and scopes, you are done.
2. Otherwise call `StartOAuthSession` with the scopes, a `sessionBindingUrl` and an optional `customState`. The broker returns an `authorizationUrl` and a `sessionUri`.
3. Send the browser to the `authorizationUrl`. The user signs in to the external service and consents. The authorization server sends the code to the broker's callback, and the broker holds it without exchanging it yet.
4. The broker redirects the browser to your `sessionBindingUrl`. Your handler checks `customState` and calls `CompleteOAuthSessionBinding` signed as the current user.
5. If the identities match, the broker exchanges the code, stores the tokens, and the next `GetOAuthToken` call returns the access token.

A mismatch fails with `AccessDeniedException` and the reason `SESSION_BINDING_IDENTITY_MISMATCH`, and no token is kept. A session that is already bound or expired fails with `SESSION_STATE_CONFLICT`, so replays are rejected. The broker redirects only to session binding URLs you allowed on the provider, up to 10, and it uses PKCE between its own endpoints [[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html). The authorization code, the client secret and the refresh token never reach your application.

> **Key takeaway**
>
> With AWS IAM Credential Broker, an agent on AWS asks for an OAuth token with its own IAM role and gets a short-lived access token. The client secret stays in Secrets Manager. User tokens are keyed to the user's IAM session, and session binding checks that the user who finishes consent is the one who started it.

### How does token exchange work?

The token exchange grant gets a token for a downstream service that represents a user who is already signed in, following RFC 8693; for Microsoft Entra ID the broker uses the JWT bearer grant from RFC 7523 instead [[5]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html). Supported vendors are Microsoft, Okta, Salesforce and custom OAuth 2.0 authorization servers.

Each provider names one `subjectTokenSource`: `iamIdentityCenter` (silent from the first call), `credentialProvider` (a separate authorization code provider the user consented to once) or `credentialProviderSelf`. If no subject token exists for the user, `GetOAuthToken` fails with `SUBJECT_TOKEN_MISSING`. The documentation says a headless caller that cannot show a browser stops there by design and should use an IAM Identity Center source [[5]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html). An optional actor configuration adds an actor token, so the authorization server sees which party acts for the user.

## What does this mean for teams running AI agents?

For teams, the change is that an agent's access to outside systems becomes an IAM permission you can grant, scope and audit, instead of a secret copied into each agent's environment. Every token request is recorded in AWS CloudTrail with the IAM role that asked for it [[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html), and you can limit which providers a role may use with tag conditions such as `aws:ResourceTag/Team` [[6]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-permissions.html).

The user flows matter most for agents that act for a person. A support agent that reads one employee's Jira tickets, or an internal assistant that queries an HR API, gets a token for that person only, and the external service applies its own per-user access control [[5]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html). The documentation tells you not to share one IAM session across users and not to cache tokens across users in your application [[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html). The same rule holds when agents share a workspace with people, as in Hardi: each agent call should carry the identity of the person it acts for.

## How do you set up Credential Broker for an agent?

The getting started guide sets up a client credentials provider for Okta so that an agent on AWS Lambda can call an Okta-protected API as itself, in about 15 minutes [[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html). The steps:

1. Create the credential provider pool in the IAM console (Credential Broker in the navigation pane) or with `aws credential-broker create-credential-provider-pool`. Wait until its status changes from `CREATING` to `READY`.
2. Create a credential provider with grant type `CLIENT_CREDENTIALS`, the Okta domain and your app's client ID and secret. The broker stores the secret in Secrets Manager.
3. Attach a policy to the agent's role that allows `credentialbroker:GetOAuthToken` on the provider ARN, plus read access to the secret only when called through the broker, using an `aws:CalledVia` condition so the agent cannot read the secret directly.
4. Call `GetOAuthToken` and send the token in an `Authorization: Bearer` header.

The guide's Lambda example, shortened:

```python
import boto3, requests

broker = boto3.client("credential-broker")

def handler(event, context):
    token = broker.get_oauth_token(
        credentialProviderArn="arn:aws:credentialbroker:us-east-1:123456789012:credentialproviderpool/pool-abc123/credentialprovider/provider-def456",
        scopes=["reports.read"],
    )["accessToken"]
    response = requests.get(
        "https://api.example.com/reports",
        headers={"Authorization": f"Bearer {token}"},
    )
    return response.status_code
```

A second call returns the cached token, and the broker gets a new one when the token nears expiry [[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html). For the authorization code grant, and for token exchange whose subject token comes from an authorization code provider, the caller also needs `credentialbroker:StartOAuthSession`, `credentialbroker:CompleteOAuthSessionBinding` and `credentialbroker:GetCredentialProvider`. Administrators can attach the AWS managed policy `IAMCredentialBrokerControlFullAccess` for setup instead of writing their own [[6]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-permissions.html).

## What are the limits and open questions?

Credential Broker is a preview, and its documentation is marked as prerelease and subject to change [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html). The limits to plan for:

- **No hosted consent page.** In this release your application sends the user to the authorization URL itself and must host the session binding handler [[4]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html).
- **No DPoP.** The Okta tutorial asks you to turn off the DPoP requirement because Credential Broker does not currently support it [[3]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html).
- **Headless user flows need Identity Center.** A background agent cannot complete a browser consent, so token exchange for it must use an IAM Identity Center subject token source [[5]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html).
- **Region rules.** A secret or customer managed key you bring must be in the same Region as the pool, and its resource policy must allow the service to use it [[6]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-permissions.html).
- **AgentCore stays separate.** AgentCore agents keep using AgentCore Identity [[2]](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html).

The announcement says nothing about pricing after the preview or a date for general availability [[1]](https://aws.amazon.com/about-aws/whats-new/2026/11/aws-iam-credential-broker-preview/). The broker also does not limit what an agent does with a token once it has one; scopes and the external service's own permissions remain the control on that side.

## Frequently asked questions

### Does AWS IAM Credential Broker issue its own tokens?

No. Your identity provider, the external authorization server or the SaaS platform issues every token. Credential Broker obtains it on your behalf, caches it encrypted and returns it to the agent.

### Should AgentCore agents use IAM Credential Broker?

No. AWS says agents built on Amazon Bedrock AgentCore should keep using AgentCore Identity. Credential Broker is meant for workloads on Lambda, ECS, EKS, EC2 and other AWS compute that call services outside AWS.

### Which OAuth flows does IAM Credential Broker support?

It supports the client credentials grant for an application acting as itself, the authorization code grant for a user who consents once in a browser, and the token exchange grant for a user who is already signed in.

### How much does AWS IAM Credential Broker cost?

There is no additional cost during the public preview, which runs in all commercial AWS Regions. AWS has not published pricing for after the preview or a date for general availability.

### What IAM permission does an agent need to get a token?

Every OAuth flow needs credentialbroker:GetOAuthToken on the provider ARN, and API key providers need credentialbroker:GetApiKey. The authorization code grant, and token exchange whose subject token comes from an authorization code provider, also need StartOAuthSession, CompleteOAuthSessionBinding and GetCredentialProvider.

## Sources

1. [AWS announces the public preview of AWS IAM Credential Broker](https://aws.amazon.com/about-aws/whats-new/2026/11/aws-iam-credential-broker-preview/) — Amazon Web Services, accessed 2026-11-30
2. [AWS IAM Credential Broker](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker.html) — Amazon Web Services, accessed 2026-11-30
3. [Getting started: Set up your first credential provider](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-setup.html) — Amazon Web Services, accessed 2026-11-30
4. [Obtain a token on behalf of a user with the authorization code grant](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-3lo.html) — Amazon Web Services, accessed 2026-11-30
5. [Obtain a token with the token exchange grant](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-obo.html) — Amazon Web Services, accessed 2026-11-30
6. [Control access to AWS IAM Credential Broker](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-permissions.html) — Amazon Web Services, accessed 2026-11-30
7. [Obtain a token for your application with the client credentials grant](https://docs.aws.amazon.com/IAM/latest/UserGuide/credential-broker-m2m.html) — Amazon Web Services, accessed 2026-11-30
