create_o_auth2_token_with_token_exchange
async
¶
create_o_auth2_token_with_token_exchange(
grant_type: TokenExchangeGrantType,
*,
config_overrides: Optional[AsyncSigninClientConfig] = None,
subject_token: Optional[SubjectToken] = None,
subject_token_type: Optional[SubjectTokenType] = None,
assertion: Optional[Assertion] = None,
client_id: Optional[JwtBearerClientId] = None,
resource: Optional[Resource] = None,
scope: Optional[Scope] = None,
) -> CreateOAuth2TokenWithTokenExchangeResponse
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:
-
grant_type(TokenExchangeGrantType) –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(Optional[SubjectToken], default: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(Optional[SubjectTokenType], default: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".
-
assertion(Optional[Assertion], default:None) –The JWT authorization grant, as defined in RFC 7523. Required when "grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer".
-
client_id(Optional[JwtBearerClientId], default:None) –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(Optional[Resource], default:None) –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(Optional[Scope], default:None) –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.
Raises:
-
InternalServerException–The request failed because of an internal server error.
-
InvalidGrantException–The request failed because the provided grant is invalid or expired.
-
InvalidScopeException–The request failed because the requested scope is invalid or exceeds the scope that can be granted.
-
ServiceUnavailableException–The request failed because a dependency is temporarily unavailable. You can retry the request.
-
TooManyRequestsError–The request failed because you exceeded the request rate limit for this operation.
-
ValidationException–The request failed because it contains a malformed, missing, or invalid parameter.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_signin/_services/async_signin.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 | |