The dedicated authorization code for TuyaOpen can be obtained through the following methods:
Method 1: Purchase a module with a TuyaOpen authorization code pre-burned. The authorization code is already burned in the corresponding module at the factory and will not be lost. TuyaOpen reads the authorization code through the tuya_iot_license_read() interface at startup. Please confirm whether the current device has a TuyaOpen authorization code pre-burned.
Method 2: If the current module is not pre-burned with a TuyaOpen authorization code, you can purchase an Open SDK Authorization Code through the https://platform.tuya.com/purchase/index?type=6 page and put ‘TUYA_DEVICE_UUID’ and ‘TUYA_DEVICE_AUTHKEY’ in the [apps/tuya_cloud/switch_demo/src/tuya_config.h](./src/tuya_config.h) file Replace the uuid and authkey obtained after successful purchase
tuya_iot_license_tlicense;if(OPRT_OK!=tuya_iot_license_read(&license)){license.uuid=TUYA_DEVICE_UUID;license.authkey=TUYA_DEVICE_AUTHKEY;PR_WARN("Replace the TUYA_DEVICE_UUID and TUYA_DEVICE_AUTHKEY contents, otherwise the demo cannot work");}
If the tuya_iot_license_read() interface returns OPRT_OK, it indicates that the current device has a TuyaOpen authorization code pre-burned. Otherwise, it indicates that the current module is not pre-burned with a TuyaOpen authorization code.