forgetDevice method

Future<void> forgetDevice({
  1. required String deviceKey,
  2. String? accessToken,
})

Forgets the specified device.

May throw ResourceNotFoundException. May throw InvalidParameterException. May throw NotAuthorizedException. May throw TooManyRequestsException. May throw InvalidUserPoolConfigurationException. May throw PasswordResetRequiredException. May throw UserNotFoundException. May throw UserNotConfirmedException. May throw InternalErrorException.

Parameter deviceKey : The device key.

Parameter accessToken : The access token for the forgotten device request.

Implementation

Future<void> forgetDevice({
  required String deviceKey,
  String? accessToken,
}) async {
  ArgumentError.checkNotNull(deviceKey, 'deviceKey');
  _s.validateStringLength(
    'deviceKey',
    deviceKey,
    1,
    55,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.ForgetDevice'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'DeviceKey': deviceKey,
      if (accessToken != null) 'AccessToken': accessToken,
    },
  );
}