Calling AssumeRoleWithWebIdentity
The temporary security credentials returned by this API consist of an access key ID,
a secret access key, and a security token. Applications can use these temporary
security credentials to sign calls to AWS service APIs. The credentials are valid
for the duration that you specified when calling AssumeRoleWithWebIdentity
Optionally, you can pass an IAM access policy to this operation. If you choose not to pass a policy, the temporary security credentials that are returned by the operation have the permissions that are defined in the access policy of the role that is being assumed. If you pass a policy to this operation, the temporary security credentials that are returned by the operation have the permissions that are allowed by both the access policy of the role that is being assumed, and the policy that you pass. This gives you a way to further restrict the permissions for the resulting temporary security credentials. You cannot use the passed policy to grant permissions that are in excess of those allowed by the access policy of the role that is being assumed. For more information, see Permissions for AssumeRoleWithWebIdentity in Using Temporary Security Credentials.
Before your application can call AssumeRoleWithWebIdentity
For more information about how to use web identity federation and the AssumeRoleWithWebIdentity
- Creating a Mobile Application with Third-Party Sign-In and Creating Temporary Security Credentials for Mobile Apps Using Third-Party Identity Providers in Using Temporary Security Credentials.
- Web Identity Federation Playground. This interactive website lets you walk through the process of authenticating via Login with Amazon, Facebook, or Google, getting temporary security credentials, and then using those credentials to make a request to AWS.
- AWS SDK for iOS and AWS SDK for Android. These toolkits contain sample apps that show how to invoke the identity providers, and then how to use the information from these providers to get and use temporary security credentials.
- Web Identity Federation with Mobile Applications. This article discusses web identity federation and shows an example of how to use web identity federation to get access to content in Amazon S3.
C# |
AssumeRoleWithWebIdentityResponse AssumeRoleWithWebIdentity( AssumeRoleWithWebIdentityRequest request )
- request (AssumeRoleWithWebIdentityRequest)
- Container for the necessary parameters to execute the AssumeRoleWithWebIdentity service method.
Exception | Condition |
---|---|
ExpiredTokenException |
The web identity token that was passed is expired or is not valid. Get a new identity
token from the identity provider and then retry the request.
|
IDPCommunicationErrorException |
The request could not be fulfilled because the non-AWS identity provider (IDP) that
was asked to verify the incoming identity token could not be reached. This is
often a transient error caused by network conditions. Retry the request a limited
number of times so that you don't exceed the request rate. If the error persists,
the non-AWS identity provider might be down or not responding.
|
IDPRejectedClaimException |
The identity provider (IdP) reported that authentication failed. This might be because
the claim is invalid.
If this error is returned for the |
InvalidIdentityTokenException |
The web identity token that was passed could not be validated by AWS. Get a new identity
token from the identity provider and then retry the request.
|
MalformedPolicyDocumentException |
The request was rejected because the policy document was malformed. The error message
describes the specific error.
|
PackedPolicyTooLargeException |
The request was rejected because the policy document was too large. The error message
describes how big the policy document is, in packed form, as a percentage of
what the API allows.
|