UpdateDeviceStatusCommand

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.

Amazon Cognito doesn't evaluate Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you can't use IAM credentials to authorize requests, and you can't grant IAM permissions in policies. For more information about authorization models in Amazon Cognito, see Using the Amazon Cognito user pools API and user pool endpoints .

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { CognitoIdentityProviderClient, UpdateDeviceStatusCommand } from "@aws-sdk/client-cognito-identity-provider"; // ES Modules import
// const { CognitoIdentityProviderClient, UpdateDeviceStatusCommand } = require("@aws-sdk/client-cognito-identity-provider"); // CommonJS import
const client = new CognitoIdentityProviderClient(config);
const input = { // UpdateDeviceStatusRequest
  AccessToken: "STRING_VALUE", // required
  DeviceKey: "STRING_VALUE", // required
  DeviceRememberedStatus: "remembered" || "not_remembered",
};
const command = new UpdateDeviceStatusCommand(input);
const response = await client.send(command);
// {};

UpdateDeviceStatusCommand Input

See UpdateDeviceStatusCommandInput for more details

Parameter
Type
Description
AccessToken
Required
string | undefined

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.

DeviceKey
Required
string | undefined

The device key of the device you want to update, for example us-west-2_a1b2c3d4-5678-90ab-cdef-EXAMPLE11111.

DeviceRememberedStatus
DeviceRememberedStatusType | undefined

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

UpdateDeviceStatusCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
ForbiddenException
client

This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.

InternalErrorException
server

This exception is thrown when Amazon Cognito encounters an internal error.

InvalidParameterException
client

This exception is thrown when the Amazon Cognito service encounters an invalid parameter.

InvalidUserPoolConfigurationException
client

This exception is thrown when the user pool configuration is not valid.

NotAuthorizedException
client

This exception is thrown when a user isn't authorized.

PasswordResetRequiredException
client

This exception is thrown when a password reset is required.

ResourceNotFoundException
client

This exception is thrown when the Amazon Cognito service can't find the requested resource.

TooManyRequestsException
client

This exception is thrown when the user has made too many requests for a given operation.

UserNotConfirmedException
client

This exception is thrown when a user isn't confirmed successfully.

UserNotFoundException
client

This exception is thrown when a user isn't found.

CognitoIdentityProviderServiceException
Base exception class for all service exceptions from CognitoIdentityProvider service.