adminForgetDevice method

Future<void> adminForgetDevice({
  1. required String deviceKey,
  2. required String userPoolId,
  3. required String username,
})

Forgets, or deletes, a remembered device from a user's profile. After you forget the device, the user can no longer complete device authentication with that device and when applicable, must submit MFA codes again. For more information, see Working with devices.

Learn more

May throw InternalErrorException. May throw InvalidParameterException. May throw InvalidUserPoolConfigurationException. May throw NotAuthorizedException. May throw OperationNotEnabledException. May throw ResourceNotFoundException. May throw TooManyRequestsException. May throw UserNotFoundException.

Parameter deviceKey : The key ID of the device that you want to delete.

Parameter userPoolId : The ID of the user pool where the device owner is a user.

Parameter username : The name of the user that you want to query or modify. The value of this parameter is typically your user's username, but it can be any of their alias attributes. If username isn't an alias attribute in your user pool, this value must be the sub of a local user or the username of a user from a third-party IdP.

Implementation

Future<void> adminForgetDevice({
  required String deviceKey,
  required String userPoolId,
  required String username,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.AdminForgetDevice'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DeviceKey': deviceKey,
      'UserPoolId': userPoolId,
      'Username': username,
    },
  );
}