Link SDK for C that is provided by IoT Platform supports the dynamic registration or unique-certificate-per-product authentication feature. This eliminates the need to burn different DeviceSecrets to devices and reduces the burning costs. You can use MQTT-based dynamic registration to obtain device authentication information and then connect devices with IoT Platform.

Prerequisites

  • A development environment is prepared.
  • Obtain the SDK.

    When you customize an SDK, set Device authentication scheme to Dynamic registration on the SDK customization page.

  • A product is created, the ProductName and ProductSecret are obtained, and dynamic registration is enabled.
  • One or more devices are added to the product and the DeviceNames are obtained if you use pre-registration unique-certificate-per-product authentication.

    For more information about the features and limits of pre-registration unique-certificate-per-product authentication and preregistration-free unique-certificate-per-product authentication, see Unique-certificate-per-product authentication.

Process

The application program calls the API operations of Link SDK for C to to implement MQTT-based dynamic registration and obtain the authentication information that are required to connect the devices with IoT Platform.

The following figure shows the process. In this example, the ./demos/dynregmq_basic_demo.c application program is used.

Process of MQTT-based dynamic registration

For more information about API operations that are related to MQTT-based dynamic registration, see aiot_dynregmq_api.h.

The following table describes the request parameters and response parameters when you initiate a request of MQTT-based dynamic registration. You can use pre-registration unique-certificate-per-product authentication or preregistration-free unique-certificate-per-product authentication based on your business requirements.

MethodRequest parameterResponse parameter
Pre-registration unique-certificate-per-product authentication
  • ProductName
  • ProductSecret
  • DeviceName
  • DeviceSecret
Preregistration-free unique-certificate-per-product authentication
  • ProductName
  • ProductSecret
  • clientId
  • userName
  • password

Examples

What to do next

After MQTT-based dynamic registration is successful, you can use the returned authentication information to activate devices and connect the devices with IoT Platform. For more information, see the following articles:
Note
  • If the device is not activated, you can perform dynamic registration multiple times. However, only the latest DeviceSecret is valid. Make sure that the latest DeviceSecret is burned on the device.
  • If the device is activated, you must call the ResetThing operation to reset the registration status of the device to unregistered in the IoT Platform console. Then, you can dynamically register the device.