Skip to content

Bedrock Agentcore  >  Operations  >  get_resource_oauth2_token

get_resource_oauth2_token

Operation

get_resource_oauth2_token async

get_resource_oauth2_token(input: GetResourceOauth2TokenInput, plugins: list[Plugin] | None = None) -> GetResourceOauth2TokenOutput

Returns the OAuth 2.0 token of the provided resource.

Parameters:

Name Type Description Default
input GetResourceOauth2TokenInput

An instance of GetResourceOauth2TokenInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
GetResourceOauth2TokenOutput

An instance of GetResourceOauth2TokenOutput.

Input

GetResourceOauth2TokenInput dataclass

Dataclass for GetResourceOauth2TokenInput structure.

Attributes

audiences class-attribute instance-attribute
audiences: list[str] | None = None

The audiences to include in the token request. These are used to specify the intended recipients of the OAuth2 token.

custom_parameters class-attribute instance-attribute
custom_parameters: dict[str, str] | None = None

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 class-attribute instance-attribute
custom_state: str | None = field(repr=False, default=None)

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.

force_authentication class-attribute instance-attribute
force_authentication: bool | None = None

Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.

oauth2_flow class-attribute instance-attribute
oauth2_flow: Oauth2FlowType | None = None

The type of flow to be performed.

resource_credential_provider_name class-attribute instance-attribute
resource_credential_provider_name: str | None = None

The name of the resource's credential provider.

resource_oauth2_return_url class-attribute instance-attribute
resource_oauth2_return_url: str | None = None

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.

resources class-attribute instance-attribute
resources: list[str] | None = None

The resources to include in the token request. These are used to specify the target resources for which the OAuth2 token is being requested.

scopes class-attribute instance-attribute
scopes: list[str] | None = None

The OAuth scopes being requested.

session_uri class-attribute instance-attribute
session_uri: str | None = None

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.

workload_identity_token class-attribute instance-attribute
workload_identity_token: str | None = field(repr=False, default=None)

The identity token of the workload from which you want to retrieve the OAuth2 token.

Output

GetResourceOauth2TokenOutput dataclass

Dataclass for GetResourceOauth2TokenOutput structure.

Attributes

access_token class-attribute instance-attribute
access_token: str | None = field(repr=False, default=None)

The OAuth 2.0 access token to use.

authorization_url class-attribute instance-attribute
authorization_url: str | None = field(repr=False, default=None)

The URL to initiate the authorization process, provided when the access token requires user authorization.

session_status class-attribute instance-attribute
session_status: SessionStatus | None = None

Status indicating whether the user's authorization session is in progress or has failed. This helps determine the next steps in the OAuth2 authentication flow.

session_uri class-attribute instance-attribute
session_uri: str | None = None

Unique identifier for the user's authorization session for retrieving OAuth2 tokens. This matches the sessionId from the request and can be used to track the session state.