verifyUserAttribute method
Submits a verification code for a signed-in user who has added or changed
a value of an auto-verified attribute. When successful, the user's
attribute becomes verified and the attribute email_verified
or phone_number_verified becomes true.
If your user pool requires verification before Amazon Cognito updates the attribute value, this operation updates the affected attribute to its pending value.
Authorize this action with a signed-in user's access token. It must
include the scope aws.cognito.signin.user.admin.
May throw AliasExistsException.
May throw CodeMismatchException.
May throw ExpiredCodeException.
May throw ForbiddenException.
May throw InternalErrorException.
May throw InvalidParameterException.
May throw LimitExceededException.
May throw NotAuthorizedException.
May throw OperationNotEnabledException.
May throw PasswordResetRequiredException.
May throw ResourceNotFoundException.
May throw TooManyRequestsException.
May throw UserNotConfirmedException.
May throw UserNotFoundException.
Parameter accessToken :
A valid access token that Amazon Cognito issued to the currently signed-in
user. Must include a scope claim for
aws.cognito.signin.user.admin.
Parameter attributeName :
The name of the attribute that you want to verify.
Parameter code :
The verification code that your user pool sent to the added or changed
attribute, for example the user's email address.
Implementation
Future<void> verifyUserAttribute({
required String accessToken,
required String attributeName,
required String code,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSCognitoIdentityProviderService.VerifyUserAttribute'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
signed: false,
// TODO queryParams
headers: headers,
payload: {
'AccessToken': accessToken,
'AttributeName': attributeName,
'Code': code,
},
);
}