SDK for PHP V3

Client: Aws\CredentialBroker\CredentialBrokerClient
Service ID: credentialbroker
Version: 2026-07-01

This page describes the parameters and results for the operations of the AWS IAM CredentialBroker (2026-07-01), and shows how to use the Aws\CredentialBroker\CredentialBrokerClient object to call the described operations. This documentation is specific to the 2026-07-01 API version of the service.

Service Description

AWS IAM CredentialBroker

AWS IAM CredentialBroker manages credentials that your workloads use to call non-AWS parties. A workload presents its AWS IAM credentials, and the broker returns a credential obtained from the third party — exchanging and refreshing it against the authorization server on the workload's behalf — so the workload never holds the third party's long-lived secrets. Credential providers are configured with the AWS IAM CredentialBroker Control API. The operations here retrieve credentials from a provider that already exists.

Operation Summary

Each of the following operations can be created from a client using $client->getCommand('CommandName'), where "CommandName" is the name of one of the following operations. Note: a command is a value that encapsulates an operation and the parameters used to create an HTTP request.

You can also create and send a command immediately using the magic methods available on a client object: $client->commandName(/* parameters */). You can send the command asynchronously (returning a promise) by appending the word "Async" to the operation name: $client->commandNameAsync(/* parameters */).

CompleteOAuthSessionBinding ( array $params = [] )
Completes a consent session.
GetApiKey ( array $params = [] )
Retrieves the API key held by an API key credential provider.
GetOAuthToken ( array $params = [] )
Retrieves an OAuth access token from a credential provider.
StartOAuthSession ( array $params = [] )
Starts a consent session so an end user can authorize the broker to obtain tokens on their behalf.

Operations

CompleteOAuthSessionBinding

$result = $client->completeOAuthSessionBinding([/* ... */]);
$promise = $client->completeOAuthSessionBindingAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->completeOAuthSessionBinding([
    'sessionUri' => '<string>', // REQUIRED
]);

Parameter Details

Members
sessionUri
Required: Yes
Type: string

The session handle from StartOAuthSession.

Result Syntax

[
    'sessionUri' => '<string>',
]

Result Details

Members
sessionUri
Required: Yes
Type: string

Echoes the bound session handle.

Errors

ThrottlingException:

The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

ServiceUnavailableException:

A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.

ResourceNotFoundException:

The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

InternalServerException:

The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

AccessDeniedException:

The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

ConflictException:

The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).

ValidationException:

The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

GetApiKey

$result = $client->getApiKey([/* ... */]);
$promise = $client->getApiKeyAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->getApiKey([
    'credentialProviderArn' => '<string>', // REQUIRED
]);

Parameter Details

Members
credentialProviderArn
Required: Yes
Type: string

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

Result Syntax

[
    'apiKey' => '<string>',
]

Result Details

Members
apiKey
Required: Yes
Type: string

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

Errors

ThrottlingException:

The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

ResourceNotFoundException:

The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

InternalServerException:

The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

AccessDeniedException:

The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

ValidationException:

The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

GetOAuthToken

$result = $client->getOAuthToken([/* ... */]);
$promise = $client->getOAuthTokenAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->getOAuthToken([
    'audiences' => ['<string>', ...],
    'credentialProviderArn' => '<string>', // REQUIRED
    'customParameters' => ['<string>', ...],
    'forceAuthentication' => true || false,
    'grantType' => 'CLIENT_CREDENTIALS|TOKEN_EXCHANGE|JWT_AUTHORIZATION_GRANT|AUTHORIZATION_CODE', // REQUIRED
    'resources' => ['<string>', ...],
    'scopes' => ['<string>', ...],
    'sessionUri' => '<string>',
]);

Parameter Details

Members
audiences
Type: Array of strings

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

credentialProviderArn
Required: Yes
Type: string

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

customParameters
Type: Associative array of custom strings keys (CustomParameterKey) to strings

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

forceAuthentication
Type: boolean

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.

grantType
Required: Yes
Type: string

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

resources
Type: Array of strings

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

scopes
Type: Array of strings

The OAuth scopes to request from the authorization server.

sessionUri
Type: string

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

Result Syntax

[
    'accessToken' => '<string>',
    'expiresAt' => <DateTime>,
    'sessionStatus' => 'IN_PROGRESS|COMPLETED|FAILED',
]

Result Details

Members
accessToken
Type: string

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

expiresAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

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
Type: string

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

Errors

ServiceQuotaExceededException:

The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using serviceCode and quotaCode, then retry.

ThrottlingException:

The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

ServiceUnavailableException:

A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.

ResourceNotFoundException:

The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

InternalServerException:

The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

AccessDeniedException:

The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

ValidationException:

The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

StartOAuthSession

$result = $client->startOAuthSession([/* ... */]);
$promise = $client->startOAuthSessionAsync([/* ... */]);

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.

Parameter Syntax

$result = $client->startOAuthSession([
    'audiences' => ['<string>', ...],
    'credentialProviderArn' => '<string>', // REQUIRED
    'customParameters' => ['<string>', ...],
    'customState' => '<string>',
    'resources' => ['<string>', ...],
    'scopes' => ['<string>', ...],
    'sessionBindingUrl' => '<string>', // REQUIRED
]);

Parameter Details

Members
audiences
Type: Array of strings

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

credentialProviderArn
Required: Yes
Type: string

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

customParameters
Type: Associative array of custom strings keys (CustomParameterKey) to strings

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

customState
Type: string

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.

resources
Type: Array of strings

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

scopes
Type: Array of strings

The OAuth scopes to request from the authorization server.

sessionBindingUrl
Required: Yes
Type: string

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.

Result Syntax

[
    'accessToken' => '<string>',
    'authorizationUrl' => '<string>',
    'expiresAt' => <DateTime>,
    'sessionStatus' => 'IN_PROGRESS|COMPLETED|FAILED',
    'sessionUri' => '<string>',
]

Result Details

Members
accessToken
Type: string

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

authorizationUrl
Type: 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.

expiresAt
Type: timestamp (string|DateTime or anything parsable by strtotime)

Expiry of accessToken when returned.

sessionStatus
Type: string

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

sessionUri
Type: string

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

Errors

ThrottlingException:

The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

ServiceUnavailableException:

A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.

ResourceNotFoundException:

The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

InternalServerException:

The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

AccessDeniedException:

The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

ValidationException:

The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

Shapes

AccessDeniedException

Description

The caller is not authorized to perform the request, or a resource the request depends on refused access. reason distinguishes a denial by this service from a denial reported by a dependency the caller configured, such as a customer-owned secret, KMS key, or external identity provider, which usually points at a permission or configuration fix outside this API.

Members
message
Required: Yes
Type: string
reason
Type: string

Identifies what denied the request. New values may be added over time, so treat an unrecognized value as a generic authorization failure and rely on message for detail.

ConflictException

Description

The request conflicts with the current state of the resource. Nothing was changed. Depending on reason, the request may succeed if retried once the resource reaches a settled state, or it may require different input (for example a name that is not already taken).

Members
message
Required: Yes
Type: string
reason
Required: Yes
Type: string

Identifies the kind of state conflict that caused the request to be rejected. New values may be added over time, so treat an unrecognized value as a generic conflict and rely on message.

resourceId
Type: string

The identifier of the resource the request conflicted with, when the service attributes the conflict to a single resource.

resourceType
Type: string

The type of the resource named by resourceId, when present.

InternalServerException

Description

The request failed because of an unexpected error in the service. Whether the request took effect is undefined, so for a create or update, read the resource back before retrying. Retryable: the same request may succeed later.

Members
message
Required: Yes
Type: string
retryAfterSeconds
Type: int

The number of seconds to wait before retrying. If this field is absent, retry with exponential backoff.

ResourceNotFoundException

Description

The requested resource does not exist, or the caller is not permitted to know that it exists. A resource that was deleted, or that is still being created, can also be reported this way.

Members
message
Required: Yes
Type: string
resourceId
Type: string

The identifier of the resource that could not be found, echoed from the request.

resourceType
Type: string

The type of the resource named by resourceId, when present.

ServiceQuotaExceededException

Description

The request would exceed a service quota, so it was rejected and nothing was created or changed. Delete resources that are no longer needed, or request a quota increase in Service Quotas using serviceCode and quotaCode, then retry.

Members
message
Required: Yes
Type: string
quotaCode
Type: string

The Service Quotas requirement that identifies the originating quota.

resourceId
Type: string

The identifier of the resource whose quota was exceeded, when the quota applies to a specific resource rather than the account.

resourceType
Type: string

The type of the resource named by resourceId, when present.

serviceCode
Type: string

The Service Quotas requirement that identifies the originating service.

ServiceUnavailableException

Description

A downstream dependency the broker relies on is temporarily unavailable, notably the customer's external IdP token/discovery endpoint (upstream 5xx, server_error, or temporarily_unavailable). Retryable: the same request may succeed later.

Members
message
Required: Yes
Type: string
retryAfterSeconds
Type: int

The number of seconds to wait before retrying. If this field is absent, retry with exponential backoff.

ThrottlingException

Description

The request was denied because the caller exceeded a request rate limit. Nothing was changed. Retry with exponential backoff, honoring retryAfterSeconds when it is present.

Members
message
Required: Yes
Type: string
retryAfterSeconds
Type: int

The number of seconds to wait before retrying. If this field is absent, retry with exponential backoff.

ValidationException

Description

The request is not valid. The request was rejected before any change was made, so it is safe to correct the input and retry. Use reason to branch in code and message for the human-readable detail of which field or combination of fields was at fault.

Members
message
Required: Yes
Type: string
reason
Required: Yes
Type: string

Identifies which validation check a request failed. New values may be added over time, so treat an unrecognized value as a generic validation failure and rely on message for detail.