AWS IAM CredentialBroker

2026/11/29 - AWS IAM CredentialBroker - 4 new api methods

Changes  Initial release of AWS IAM CredentialBroker Data Plane API reference, which enables your applications and agents on AWS to securely access external systems through OAuth access tokens and API keys, including on behalf of users, without storing long-lived secrets in code.

StartOAuthSession (new) Link ¶

Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf. Returns a URL to send the user's browser to, and a handle identifying the session.

Call this when GetOAuthToken returns no token for a provider that requires user consent. When a valid token is already available, this returns it directly and no consent is needed.

The operation is not idempotent and takes no idempotency token: it is an OAuth consent-flow step rather than durable resource creation. A replayed session is rejected by CompleteOAuthSessionBinding with SESSION_STATE_CONFLICT.

See also: AWS API Documentation

Request Syntax

client.start_o_auth_session(
    credentialProviderArn='string',
    scopes=[
        'string',
    ],
    sessionBindingUrl='string',
    resources=[
        'string',
    ],
    audiences=[
        'string',
    ],
    customParameters={
        'string': 'string'
    },
    customState='string'
)
type credentialProviderArn:

string

param credentialProviderArn:

[REQUIRED]

Amazon Resource Name of the credential provider the user is granting consent for.

type scopes:

list

param scopes:

The OAuth scopes to request from the authorization server.

  • (string) --

type sessionBindingUrl:

string

param sessionBindingUrl:

[REQUIRED]

The URL the end user's browser is returned to once they have responded to the consent prompt. Must match one of the session-binding URLs allowed on the provider.

type resources:

list

param resources:

Resource indicators (RFC 8707) naming the APIs this token is for. Omit unless the authorization server requires them.

  • (string) --

type audiences:

list

param audiences:

Audience values (RFC 8693) naming the intended recipients of this token. Omit unless the authorization server requires them.

  • (string) --

type customParameters:

dict

param customParameters:

Extra parameters to include in the request to the authorization server, for vendor extensions. Added to the standard OAuth parameters; they never override them.

  • (string) --

    • (string) --

type customState:

string

param customState:

An opaque string of your own that is sent back to your session-binding URL unchanged. Use it to tie the response to the request you issued, so your handler can reject a response it did not initiate.

rtype:

dict

returns:

Response Syntax

{
    'authorizationUrl': 'string',
    'sessionUri': 'string',
    'sessionStatus': 'IN_PROGRESS'|'COMPLETED'|'FAILED',
    'accessToken': 'string',
    'expiresAt': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • authorizationUrl (string) --

      The URL to send the end user's browser to so they can grant consent. Present only when consent is required; absent when a token was available and is returned instead.

    • sessionUri (string) --

      Opaque handle to the pending consent session. Present only when interactive consent is required (absent when accessToken is returned).

    • sessionStatus (string) --

      Status of the session (IN_PROGRESS when consent is required).

    • accessToken (string) --

      Present only when a valid token already existed (no consent needed).

    • expiresAt (datetime) --

      Expiry of accessToken when returned.

GetOAuthToken (new) Link ¶

Retrieves an OAuth access token from a credential provider. The broker authenticates to the provider's authorization server with the client credentials configured on the provider, obtains a token, and returns it — so your workload never handles the provider's client secret.

The broker caches the access token it obtains until that token expires, or for up to one hour when the token's own lifetime is longer than an hour. A call made while a cached token is still valid returns that token instead of requesting a new one; set forceAuthentication to bypass the cache and force a fresh request to the authorization server.

The grant type you name must be one the provider allows. CLIENT_CREDENTIALS returns a token representing the workload itself; TOKEN_EXCHANGE returns a token that preserves the identity of the caller the workload is acting for; AUTHORIZATION_CODE returns a token representing an end user who granted consent, and requires a consent session that user has already completed, named in sessionUri; JWT_AUTHORIZATION_GRANT presents a signed JWT as the grant, so no client secret is sent on the token request. Of the supported vendors, only Microsoft Entra ID accepts this grant today: Entra implements on-behalf-of delegation with the RFC 7523 JWT bearer grant ( urn:ietf:params:oauth:grant-type:jwt-bearer), where other authorization servers use RFC 8693 token exchange.

See also: AWS API Documentation

Request Syntax

client.get_o_auth_token(
    credentialProviderArn='string',
    grantType='CLIENT_CREDENTIALS'|'TOKEN_EXCHANGE'|'JWT_AUTHORIZATION_GRANT'|'AUTHORIZATION_CODE',
    scopes=[
        'string',
    ],
    resources=[
        'string',
    ],
    audiences=[
        'string',
    ],
    customParameters={
        'string': 'string'
    },
    forceAuthentication=True|False,
    sessionUri='string'
)
type credentialProviderArn:

string

param credentialProviderArn:

[REQUIRED]

Amazon Resource Name of the credential provider to obtain the token from. The provider must be an OAuth provider and must be READY.

type grantType:

string

param grantType:

[REQUIRED]

How the token is obtained. Must be one of the grant types the provider allows; a grant the provider does not allow is rejected.

type scopes:

list

param scopes:

The OAuth scopes to request from the authorization server.

  • (string) --

type resources:

list

param resources:

Resource indicators (RFC 8707) naming the APIs this token is for. Omit unless the authorization server requires them.

  • (string) --

type audiences:

list

param audiences:

Audience values (RFC 8693) naming the intended recipients of this token. Omit unless the authorization server requires them.

  • (string) --

type customParameters:

dict

param customParameters:

Extra parameters to include in the request to the authorization server, for vendor extensions. Added to the standard OAuth parameters; they never override them.

  • (string) --

    • (string) --

type forceAuthentication:

boolean

param forceAuthentication:

Request a new token from the authorization server even when the broker already holds a valid one for this provider. Defaults to false, which returns the held token when one is available.

type sessionUri:

string

param sessionUri:

Return the token obtained for a consent session that a user has already completed. Supply the handle returned when the session was started.

rtype:

dict

returns:

Response Syntax

{
    'accessToken': 'string',
    'expiresAt': datetime(2015, 1, 1),
    'sessionStatus': 'IN_PROGRESS'|'COMPLETED'|'FAILED'
}

Response Structure

  • (dict) --

    • accessToken (string) --

      The access token. Present it to the third-party API as a bearer credential.

    • expiresAt (datetime) --

      When the access token expires. Absent when the authorization server does not report an expiry, in which case the token's lifetime is whatever that server applies.

    • sessionStatus (string) --

      Status of the consent session named in the request, so a repeated call can tell whether the user has finished granting consent.

CompleteOAuthSessionBinding (new) Link ¶

Completes a consent session. Call this from the handler at your session-binding URL, over a session carrying the same end-user identity that started the flow. On a match the broker obtains the token and holds it for later retrieval. On a mismatch it fails with AccessDeniedException and reason SESSION_BINDING_IDENTITY_MISMATCH, and no token is kept.

See also: AWS API Documentation

Request Syntax

client.complete_o_auth_session_binding(
    sessionUri='string'
)
type sessionUri:

string

param sessionUri:

[REQUIRED]

The session handle from StartOAuthSession.

rtype:

dict

returns:

Response Syntax

{
    'sessionUri': 'string'
}

Response Structure

  • (dict) --

    • sessionUri (string) --

      Echoes the bound session handle.

GetApiKey (new) Link ¶

Retrieves the API key held by an API key credential provider. The broker reads the key from the AWS Secrets Manager secret the provider was configured with and returns it, so your workload does not need its own access to that secret.

See also: AWS API Documentation

Request Syntax

client.get_api_key(
    credentialProviderArn='string'
)
type credentialProviderArn:

string

param credentialProviderArn:

[REQUIRED]

Amazon Resource Name of the credential provider to obtain the key from. The provider must be an API key provider and must be READY.

rtype:

dict

returns:

Response Syntax

{
    'apiKey': 'string'
}

Response Structure

  • (dict) --

    • apiKey (string) --

      The API key. Present it to the third-party API however that API expects, commonly a header or query parameter.