Skip to content

update_device_status async

update_device_status(
    access_token: TokenModelType,
    device_key: DeviceKeyType,
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    device_remembered_status: Optional[DeviceRememberedStatusType] = None,
) -> UpdateDeviceStatusResponse

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.

Parameters:

  • access_token (TokenModelType) –

    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.

  • device_key (DeviceKeyType) –

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

  • device_remembered_status (Optional[DeviceRememberedStatusType], default: None ) –

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

Raises:

Source code in docs_src/capo_cognito_identity_provider/_services/async_cognito_identity_provider.py
async def update_device_status(
    self,
    access_token: "capo_cognito_identity_provider.types.token_model_type.TokenModelType",
    device_key: "capo_cognito_identity_provider.types.device_key_type.DeviceKeyType",
    *,
    config_overrides: Optional[AsyncCognitoIdentityProviderClientConfig] = None,
    device_remembered_status: Optional[
        "capo_cognito_identity_provider.types.device_remembered_status_type.DeviceRememberedStatusType"
    ] = None,
) -> "capo_cognito_identity_provider.types.update_device_status_response.UpdateDeviceStatusResponse":
    """<p>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 <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-user-pools-device-tracking.html">Working with devices</a>.</p> <p>Authorize this action with a signed-in user's access token. It must include the scope <code>aws.cognito.signin.user.admin</code>.</p> <note> <p>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 <a href="https://docs.aws.amazon.com/cognito/latest/developerguide/user-pools-API-operations.html">Using the Amazon Cognito user pools API and user pool endpoints</a>.</p> </note>

    Args:
        access_token: <p>A valid access token that Amazon Cognito issued to the currently signed-in user. Must include a scope claim for <code>aws.cognito.signin.user.admin</code>.</p>
        device_key: <p>The device key of the device you want to update, for example <code>us-west-2_a1b2c3d4-5678-90ab-cdef-EXAMPLE11111</code>.</p>
        device_remembered_status: <p>To enable device authentication with the specified device, set to <code>remembered</code>.To disable, set to <code>not_remembered</code>.</p>

    Raises:
        capo_cognito_identity_provider.errors.forbidden_exception.ForbiddenException: <p>This exception is thrown when WAF doesn't allow your request based on a web ACL that's associated with your user pool.</p>
        capo_cognito_identity_provider.errors.internal_error_exception.InternalErrorException: <p>This exception is thrown when Amazon Cognito encounters an internal error.</p>
        capo_cognito_identity_provider.errors.invalid_parameter_exception.InvalidParameterException: <p>This exception is thrown when the Amazon Cognito service encounters an invalid parameter.</p>
        capo_cognito_identity_provider.errors.invalid_user_pool_configuration_exception.InvalidUserPoolConfigurationException: <p>This exception is thrown when the user pool configuration is not valid.</p>
        capo_cognito_identity_provider.errors.not_authorized_exception.NotAuthorizedException: <p>This exception is thrown when a user isn't authorized.</p>
        capo_cognito_identity_provider.errors.operation_not_enabled_exception.OperationNotEnabledException: <p>This exception is thrown when an operation is not available in the current region or for the current user pool configuration. This can occur when attempting to perform operations that are not supported in secondary replica regions.</p>
        capo_cognito_identity_provider.errors.password_reset_required_exception.PasswordResetRequiredException: <p>This exception is thrown when a password reset is required.</p>
        capo_cognito_identity_provider.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception is thrown when the Amazon Cognito service can't find the requested resource.</p>
        capo_cognito_identity_provider.errors.too_many_requests_exception.TooManyRequestsException: <p>This exception is thrown when the user has made too many requests for a given operation.</p>
        capo_cognito_identity_provider.errors.user_not_confirmed_exception.UserNotConfirmedException: <p>This exception is thrown when a user isn't confirmed successfully.</p>
        capo_cognito_identity_provider.errors.user_not_found_exception.UserNotFoundException: <p>This exception is thrown when a user isn't found.</p>
        capo_cognito_identity_provider.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cognito_identity_provider.types.update_device_status_request.UpdateDeviceStatusRequest]",
    ) -> AsyncOperationResponse[
        "capo_cognito_identity_provider.types.update_device_status_response.UpdateDeviceStatusResponse"
    ]:
        import capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_device_status

        (
            output,
            http_response,
        ) = await capo_cognito_identity_provider._operations.aws_cognito_identity_provider_service.update_device_status.async_update_device_status(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_cognito_identity_provider.types.update_device_status_request.UpdateDeviceStatusRequest",
    ) -> dict[str, Any]:
        import capo_cognito_identity_provider.types.update_device_status_request

        return capo_cognito_identity_provider.types.update_device_status_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("UpdateDeviceStatus", redact_input=_redact_input),
    )
    input_: capo_cognito_identity_provider.types.update_device_status_request.UpdateDeviceStatusRequest = {
        "access_token": access_token,
        "device_key": device_key,
    }
    if device_remembered_status is not None:
        input_["device_remembered_status"] = device_remembered_status

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output