Skip to content

create_o_auth2_token_with_token_exchange

Operation

create_o_auth2_token_with_token_exchange

Exchanges a supported token for an OAuth 2.0 access token scoped to a resource, which you can use to access AWS services from applications.

Parameters:

Name Type Description Default
request CreateOAuth2TokenWithTokenExchangeInput | CreateOAuth2TokenWithTokenExchangeInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateOAuth2TokenWithTokenExchangeInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateOAuth2TokenWithTokenExchangeOutput

An instance of CreateOAuth2TokenWithTokenExchangeOutput.

create_o_auth2_token_with_token_exchange async

Exchanges a supported token for an OAuth 2.0 access token scoped to a resource, which you can use to access AWS services from applications.

Parameters:

Name Type Description Default
request CreateOAuth2TokenWithTokenExchangeInput | CreateOAuth2TokenWithTokenExchangeInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
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
**kwargs Unpack[CreateOAuth2TokenWithTokenExchangeInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateOAuth2TokenWithTokenExchangeOutput

An instance of CreateOAuth2TokenWithTokenExchangeOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreateOAuth2TokenWithTokenExchangeInputDict

Bases: TypedDict

Dictionary form of CreateOAuth2TokenWithTokenExchangeInput.

Attributes

grant_type instance-attribute
grant_type: Required[str]

The OAuth 2.0 grant type. Currently only supports "urn:ietf:params:oauth:grant-type:token-exchange".

resource instance-attribute
resource: str | None

The OAuth resource for which the access token is requested. Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange". Example: "glue.amazonaws.com".

scope instance-attribute
scope: str | None

IAM managed policy Amazon Resource Names (ARNs) to apply as session policies that further scope down the permissions of the issued access token, provided as a space-delimited list. Example: "arn:aws:iam::444455556666:policy/MyPolicy".

subject_token instance-attribute
subject_token: str | None

The subject token that represents the identity of the party on whose behalf the request is made. Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".

subject_token_type instance-attribute
subject_token_type: str | None

The token type of the subject token. Currently only supports "urn:ietf:params:oauth:token-type:jwt". Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".

CreateOAuth2TokenWithTokenExchangeInput dataclass

Bases: _SerdeShape

Input structure for CreateOAuth2TokenWithTokenExchange operation

Attributes

grant_type class-attribute instance-attribute
grant_type: str | None = ...

The OAuth 2.0 grant type. Currently only supports "urn:ietf:params:oauth:grant-type:token-exchange".

resource class-attribute instance-attribute
resource: str | None = ...

The OAuth resource for which the access token is requested. Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange". Example: "glue.amazonaws.com".

scope class-attribute instance-attribute
scope: str | None = ...

IAM managed policy Amazon Resource Names (ARNs) to apply as session policies that further scope down the permissions of the issued access token, provided as a space-delimited list. Example: "arn:aws:iam::444455556666:policy/MyPolicy".

subject_token class-attribute instance-attribute
subject_token: str | None = ...

The subject token that represents the identity of the party on whose behalf the request is made. Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".

subject_token_type class-attribute instance-attribute
subject_token_type: str | None = ...

The token type of the subject token. Currently only supports "urn:ietf:params:oauth:token-type:jwt". Required when "grant_type=urn:ietf:params:oauth:grant-type:token-exchange".

Output

CreateOAuth2TokenWithTokenExchangeOutput dataclass

Bases: _SerdeShape

Output structure for CreateOAuth2TokenWithTokenExchange operation. Contains the access token, issued token type, token type, and expiration as defined in RFC 6749 §5.1 and RFC 8693 §2.2.1.

Attributes

access_token instance-attribute
access_token: str

Access token containing principal identity, resource scope, and session metadata.

expires_in instance-attribute
expires_in: int

Token lifetime in seconds. Value is the minimum of the subject token's validity and 1 hour (3600 seconds).

issued_token_type class-attribute instance-attribute
issued_token_type: str | None = ...

The token type of the issued token. Always "urn:ietf:params:oauth:token-type:access_token" as defined in RFC 8693 §2.2.1.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

token_type instance-attribute
token_type: str

The token type. Currently only supports "Bearer" as defined in RFC 6749.