updateDeviceStatus method

Future<void> updateDeviceStatus({
  1. required String accessToken,
  2. required String deviceKey,
  3. DeviceRememberedStatusType? deviceRememberedStatus,
})

Updates the status of a the currently signed-in user's device so that it is marked as remembered or not remembered for the purpose of device authentication. Device authentication is a "remember me" mechanism that silently completes sign-in from trusted devices with a device key instead of a user-provided MFA code. This operation changes the status of a device without deleting it, so you can enable it again later. For more information about device authentication, see Working with devices.

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 InvalidUserPoolConfigurationException. 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 deviceKey : The device key of the device you want to update, for example us-west-2_a1b2c3d4-5678-90ab-cdef-EXAMPLE11111.

Parameter deviceRememberedStatus : To enable device authentication with the specified device, set to remembered.To disable, set to not_remembered.

Implementation

Future<void> updateDeviceStatus({
  required String accessToken,
  required String deviceKey,
  DeviceRememberedStatusType? deviceRememberedStatus,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSCognitoIdentityProviderService.UpdateDeviceStatus'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    signed: false,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccessToken': accessToken,
      'DeviceKey': deviceKey,
      if (deviceRememberedStatus != null)
        'DeviceRememberedStatus': deviceRememberedStatus.value,
    },
  );
}