Device authentication FAQ
This topic describes common issues and causes related to device registration and authentication.
Can multiple devices use the same certificate to authenticate a connection?
No. At any given time, only one device can use a specific device certificate to connect to IoT Platform. If you flash the same device certificate onto multiple devices, the device that connected first is disconnected when a subsequent device tries to authenticate.
Can I download MQTT connection parameters in a batch?
IoT Platform currently does not support downloading Message Queuing Telemetry Transport (MQTT) connection parameters for multiple devices in a batch.
You can view the MQTT connection parameters for a single device in the IoT Platform console. This is useful for testing the connection and authentication when a device connects to IoT Platform. For more information, see View MQTT signing parameters.
For production applications, you must calculate and construct the connection parameters in your code. For more information, see MQTT-TLS connection, MQTT-WebSocket connection, and MQTT connection over IPv6.
Use the device-side software development kit (SDK) provided by Alibaba Cloud. The SDK handles the MQTT connection signing mechanism for you. For more information, see Device-side Link SDKs.
If you do not use the device-side SDK from Alibaba Cloud IoT Platform, you can use the provided code examples. These examples show how to connect a device to IoT Platform using the open source Paho MQTT library. For code examples in different languages and the signature algorithm files, see MQTT connection signature examples.
Does the device-side SDK support automatic reconnection for MQTT?
This is supported.
Test scenario: A development board connects to a router over Wi-Fi. When the network cable is unplugged, the device-side MQTT client automatically tries to reconnect to the server. The reconnection interval starts at 1 s, then 2 s, 4 s, 8 s, and so on. For the C SDK, the default maximum retry interval is 60 seconds. If the device remains disconnected, it retries every 60 seconds. You can customize this maximum interval.
For the Android and Java SDKs, the maximum interval is 128 seconds and cannot be customized.
What do I do if registration is denied after five pre-registration-free attempts?
A device can be registered without pre-registration only five times. After five attempts, further registration and authentication are denied. To register this device again, you must first purge its ClientID, and then re-register it.
IoT Platform provides the DeleteClientIds API operation to purge all ClientIDs for a device. To delete the ClientIDs for multiple devices, call this operation in a loop.
The maximum number of requests per second (QPS) for the DeleteClientIds API operation is 10 for a single Alibaba Cloud account. All Resource Access Management (RAM) users under an Alibaba Cloud account share the account's quota.
Which regions and instances support pre-registration-free, one-device-one-secret authentication?
Devices in Enterprise instances of IoT Platform in the China (Shanghai) and China (Beijing) regions support connection using the pre-registration-free, one-device-one-secret method.
For more information, see One-device-one-secret.
MQTT dynamic registration with a ProductSecret: failed to obtain DeviceSecret
If a device is already active, call the ResetThing API operation to reset its dynamic registration status to Unregistered. You can then dynamically register the device again.
For more information, see Dynamic registration over MQTT.
Can a DeviceName be registered only once using the per-device certificate pre-registration method?
A device name must be unique within a product. Pre-registration involves obtaining the DeviceSecret that corresponds to a DeviceName to obtain a device certificate set (ProductKey, DeviceName, and DeviceSecret). A single device certificate set can be used to activate only one physical device.
If a physical device, Device A, is already activated with a specific DeviceName:
Device A cannot be pre-registered again. To re-register it, call the ResetThing API operation to reset its status to Inactive. Then, reconnect Device A to the network to activate it. The DeviceSecret does not change.
If another physical device, Device B, needs to use the same DeviceName, you must first delete Device A in IoT Platform. This action invalidates the DeviceSecret for Device A. Then, register a new device with the original DeviceName to obtain a new DeviceSecret for activating Device B.