Tuya IoT on Alibaba Cloud provides APIs for user login and device authorization. You can call the User Login API to authenticate a developer account and obtain access tokens for specified devices.
DISCLAIMER
Please note that all content presented on this page is provided by Tuya (HK) Limited. Alibaba Cloud makes no representations and warranties, explicit or implied, as to the authenticity or accuracy of any such content, nor makes any guarantee to the condition, quality, durability, performance, reliability, merchantability or fitness for a particular purpose, or non-infringement of any products and/or services made available by Tuya (HK) Limited.
User Login
Authenticates a developer account and authorizes access to specified devices.
-
URL : POST:/v1.0/openapi/visual/d/user/login
-
Method : POST
-
Login required : yes
-
Authentication required : yes
Request Parameters
|
Parameters |
Type |
Description |
|
UserName |
String |
Developer account name |
|
Password |
String |
Developer Password |
|
DeviceList |
List <Object> |
List of devices requiring authorization |
|
DeviceInfo |
Object |
Device Object |
|
ProductKey |
String |
Device Product Key |
|
DeviceName |
String |
Device name |
Request Example
{
"userName": "userName", // 开发者账户名
"password": "password", // 开发者密码
"deviceList": [ // 需要授权的设备列表
{
"productKey": "wkNCAsnnlsYSnI6n", // 设备产品Key
"deviceName": "2ac4d7cffa" // 设备名称
}
]
}
Successful Response
-
Condition : The request parameters are valid and identity verification succeeds.
-
Status code: 200 OK
|
Parameters |
Type |
Description |
|
Success |
Boolean |
Whether the request succeeded |
|
Msg |
String |
Error message, if any |
|
T |
Long |
Request timestamp |
|
Data |
Object |
Response data object |
|
DeviceVisualTokenList |
List <Object> |
List of device token objects |
|
ProductKey |
String |
Device Product Key |
|
DeviceName |
String |
Device name |
|
VisualToken |
String |
Device access token |
|
Expire |
Integer |
Expiration Time (seconds) |
Response Example
{
"success": true,
"msg": null,
"t": 1737621418759,
"data": {
"deviceVisualTokenList": [
{
"productKey": "wkNCAsnnlsYSnI6n", // 设备产品Key
"deviceName": "2ac4d7cffa", // 设备名称
"visualToken": "eyJhbGciNiJ9.xxx.5f5Nd5JNaP-O2LBmYJZO0_9thFU",
"expire": 3600 // 过期时间,单位秒。
}
]
}
}
Precautions
Each visualToken is a unique access credential bound to a specific device.