SignInClient.create_o_auth2_token_with_token_exchange
rboto-signin==0.4.0 · Service index · Types
Model summary (excerpt): 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.
Install and imports
from rboto import SignInClient
from rboto_signin.types import (
CreateOAuth2TokenWithTokenExchangeOutput,
)
Signature
async def create_o_auth2_token_with_token_exchange(
*,
grant_type: str,
subject_token: str | None = None,
subject_token_type: str | None = None,
assertion: str | None = None,
client_id: str | None = None,
resource: str | None = None,
scope: str | None = None,
) -> CreateOAuth2TokenWithTokenExchangeOutput: ...
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) |
|---|---|---|
grant_type |
Yes | The OAuth 2.0 grant type. Currently supports "urn:ietf:params:oauth:grant-type:token-exchange" and "urn:ietf:params:oauth:grant-type:jwt-bearer". |
subject_token |
No | 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 |
No | 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". |
assertion |
No | The JWT authorization grant, as defined in RFC 7523. Required when "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer". |
client_id |
No | The OAuth 2.0 client identifier. If provided with "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer", must match the assertion's "client_id" claim. |
resource |
No | The OAuth resource for which the access token is requested: - "grant_type=urn:ietf:params:oauth:grant-type:token-exchange": Required. Must be a service principal. Example: "glue.amazonaws.com". - "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer": Required when the assertion has no "resource" claim, otherwise must match it. Must be a URI. Example: "https://aws-mcp.us-east-1.api.aws/mcp". |
scope |
No | The 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". If provided with "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer", must match the assertion's "scope" claim. |
Output
CreateOAuth2TokenWithTokenExchangeOutput.
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 |
|---|---|---|---|
access_token |
str |
Always present | — |
issued_token_type |
str | None |
Always present | — |
token_type |
str |
Always present | — |
expires_in |
int |
Always present | — |
resource |
str | None |
Always present | — |
scope |
str | None |
Always present | — |
| 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.
Related types
CreateOAuth2TokenWithTokenExchangeOutput
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_signin.exceptions:
InternalServerError, InvalidGrantError, InvalidScopeError, ServiceUnavailableError, TooManyRequestsError, ValidationError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.