get_credentials_for_identity
¶
get_credentials_for_identity(
identity_id: IdentityId,
*,
config_overrides: Optional[CognitoIdentityClientConfig] = None,
logins: Optional[LoginsMap] = None,
custom_role_arn: Optional[ARNString] = None,
) -> GetCredentialsForIdentityResponse
Returns credentials for the provided identity ID. Any provided logins will be validated against supported login providers. If the token is for cognito-identity.amazonaws.com, it will be passed through to Security Token Service with the appropriate role for the token.
This is a public API. You do not need any credentials to call this API.
Parameters:
-
identity_id(IdentityId) –A unique identifier in the format REGION:GUID.
-
logins(Optional[LoginsMap], default:None) –A set of optional name-value pairs that map provider names to provider tokens. The name-value pair will follow the syntax "provider_name": "provider_user_identifier".
Logins should not be specified when trying to get credentials for an unauthenticated identity.
The Logins parameter is required when using identities associated with external identity providers such as Facebook. For examples of
Loginsmaps, see the code examples in the External Identity Providers section of the Amazon Cognito Developer Guide. -
custom_role_arn(Optional[ARNString], default:None) –The Amazon Resource Name (ARN) of the role to be assumed when multiple roles were received in the token from the identity provider. For example, a SAML-based identity provider. This parameter is optional for identity providers that do not support role customization.
Raises:
-
ExternalServiceException–An exception thrown when a dependent service such as Facebook or Twitter is not responding
-
InternalErrorException–Thrown when the service encounters an error during processing the request.
-
InvalidIdentityPoolConfigurationException–If you provided authentication information in the request, the identity pool has no authenticated role configured, or STS returned an error response to the request to assume the authenticated role from the identity pool. If you provided no authentication information in the request, the identity pool has no unauthenticated role configured, or STS returned an error response to the request to assume the unauthenticated role from the identity pool.
Your role trust policy must grant
AssumeRoleWithWebIdentitypermissions tocognito-identity.amazonaws.com. -
InvalidParameterException–Thrown for missing or bad input parameter(s).
-
NotAuthorizedException–Thrown when a user is not authorized to access the requested resource.
-
ResourceConflictException–Thrown when a user tries to use a login which is already linked to another account.
-
ResourceNotFoundException–Thrown when the requested resource (for example, a dataset or record) does not exist.
-
TooManyRequestsException–Thrown when a request is throttled.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_cognito_identity/_services/cognito_identity.py
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 | |