deleteUserAttributes method

Future<void> deleteUserAttributes({
  1. required String accessToken,
  2. required List<String> userAttributeNames,
})

Deletes attributes from the currently signed-in user. For example, your application can submit a request to this operation when a user wants to remove their birthdate attribute value.

Authorize this action with a signed-in user's access token. It must include the scope aws.cognito.signin.user.admin.

May throw ForbiddenException. May throw InternalErrorException. May throw InvalidParameterException. 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 userAttributeNames : An array of strings representing the user attribute names you want to delete.

For custom attributes, you must prepend the custom: prefix to the attribute name, for example custom:department.

Implementation

Future<void> deleteUserAttributes({
  required String accessToken,
  required List<String> userAttributeNames,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.DeleteUserAttributes'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessToken': accessToken,
      'UserAttributeNames': userAttributeNames,
    },
  );
}