Skip to content

BedrockAgentCoreClient.get_resource_oauth2_token

rboto-bedrock-agentcore==0.4.0 · Service index · Types

Model summary (excerpt): Returns the OAuth 2.0 token of the provided resource.

Install and imports

python -m pip install "rboto[bedrock-agentcore]==0.4.0"
from rboto import BedrockAgentCoreClient
from collections.abc import Sequence
from rboto_bedrock_agentcore.types import (
    GetResourceOauth2TokenOutput,
    Oauth2FlowType,
)

Signature

async def get_resource_oauth2_token(
    *,
    workload_identity_token: str,
    resource_credential_provider_name: str,
    scopes: Sequence[str],
    oauth2_flow: Oauth2FlowType,
    session_uri: str | None = None,
    resource_oauth2_return_url: str | None = None,
    force_authentication: bool | None = None,
    custom_parameters: dict[str, str] | None = None,
    custom_state: str | None = None,
    resources: Sequence[str] | None = None,
    audiences: Sequence[str] | None = None,
) -> GetResourceOauth2TokenOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
workload_identity_token Yes The identity token of the workload from which you want to retrieve the OAuth2 token.
resource_credential_provider_name Yes The name of the resource's credential provider.
scopes Yes The OAuth scopes being requested.
oauth2_flow Yes The type of flow to be performed.
session_uri No Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.
resource_oauth2_return_url No The callback URL to redirect to after the OAuth 2.0 token retrieval is complete. This URL must be one of the provided URLs configured for the workload identity.
force_authentication No Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.
custom_parameters No A map of custom parameters to include in the authorization request to the resource credential provider. These parameters are in addition to the standard OAuth 2.0 flow parameters, and will not override them.
custom_state No An opaque string that will be sent back to the callback URL provided in resourceOauth2ReturnUrl. This state should be used to protect the callback URL of your application against CSRF attacks by ensuring the response corresponds to the original request.
resources No The resources to include in the token request. These are used to specify the target resources for which the OAuth2 token is being requested.
audiences No The audiences to include in the token request. These are used to specify the intended recipients of the OAuth2 token.

Output

GetResourceOauth2TokenOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
authorization_url str | None Always present —
access_token str | None Always present —
session_uri str | None Always present —
session_status SessionStatusOutput | None Always present SessionStatusOutput

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

GetResourceOauth2TokenOutput, Oauth2FlowType

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_bedrock_agentcore.exceptions:

AccessDeniedError, InternalServerError, ResourceNotFoundError, ThrottlingError, UnauthorizedError, ValidationError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model