in src/Amazon.AspNetCore.Identity.Cognito/CognitoUserStore/CognitoUserStore.cs [471:494]
public virtual async Task<IdentityResult> VerifyUserAttributeAsync(TUser user, string attributeName, string code, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (attributeName != CognitoAttribute.PhoneNumber.AttributeName && attributeName != CognitoAttribute.Email.AttributeName)
{
throw new ArgumentException(string.Format("Invalid attribute name, only {0} and {1} can be verified", CognitoAttribute.PhoneNumber, CognitoAttribute.Email), nameof(attributeName));
}
try
{
await _cognitoClient.VerifyUserAttributeAsync(new VerifyUserAttributeRequest
{
AccessToken = user.SessionTokens.AccessToken,
AttributeName = attributeName,
Code = code
}, cancellationToken).ConfigureAwait(false);
return IdentityResult.Success;
}
catch (AmazonCognitoIdentityProviderException e)
{
return IdentityResult.Failed(_errorDescribers.CognitoServiceError("Failed to verify the attribute for the Cognito User", e));
}
}