AWS SDK for .NET Documentation
AssumeRoleWithWebIdentity Method (request)
AmazonAmazon.SecurityTokenAmazonSecurityTokenServiceClientAssumeRoleWithWebIdentity(AssumeRoleWithWebIdentityRequest) Did this page help you?   Yes   No    Tell us about it...
Returns a set of temporary security credentials for users who have been authenticated in a mobile or web application with a web identity provider, such as Login with Amazon, Facebook, or Google.

Calling

CopyC#
AssumeRoleWithWebIdentity
does not require the use of AWS security credentials. Therefore, you can distribute an application (for example, on mobile devices) that requests temporary security credentials without including long-term AWS credentials in the application, and without deploying server-based proxy services that use long-term AWS credentials. Instead, the identity of the caller is validated by using a token from the web identity provider.

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

CopyC#
AssumeRoleWithWebIdentity
, which can be from 900 seconds (15 minutes) to 3600 seconds (1 hour). By default, the temporary security credentials are valid for 1 hour.

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

CopyC#
AssumeRoleWithWebIdentity
, you must have an identity token from a supported identity provider and create a role that the application can assume. The role that your application assumes must trust the identity provider that is associated with the identity token. In other words, the identity provider must be specified in the role's trust policy.

For more information about how to use web identity federation and the

CopyC#
AssumeRoleWithWebIdentity
, see the following resources:

......
Declaration Syntax
C#
public AssumeRoleWithWebIdentityResponse AssumeRoleWithWebIdentity(
	AssumeRoleWithWebIdentityRequest request
)
Parameters
request (AssumeRoleWithWebIdentityRequest)
Container for the necessary parameters to execute the AssumeRoleWithWebIdentity service method.
Return Value
The response from the AssumeRoleWithWebIdentity service method, as returned by SecurityTokenService.
Exceptions
ExceptionCondition
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

CopyC#
AssumeRoleWithWebIdentity
operation, it can also mean that the claim has expired or has been explicitly revoked.


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.

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)