Professional Documents
Culture Documents
QR Code Authorization Login - Tuya Smart - App Development
QR Code Authorization Login - Tuya Smart - App Development
QR Code Authorization Login - Tuya Smart - App Development
Version: 20201230
Online Version
Contents
Contents
1 Flow description 2
1.1 Get token . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Generate QR code . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Get login status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.4 Scan QR code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.5 Authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Interface description 5
2.1 Get token interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 Get login status interface . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 Authorization interface . . . . . . . . . . . . . . . . . . . . . . . . . 6
i
Contents
Note: The app in the following process and the accounting system of the central
control device need to be associated to be used, otherwise, an error will be
reported.
For example, if you use the Tuya Smart app to scan the QR code of your SDK
created by the IoT platform, an error will be reported and the session will be
invalid.
1/7
1 FLOW DESCRIPTION
1 Flow description
The QR code authorization login function is suitable for APP scanning code to au-
thorize another device to log in to the same account. The device can be a central
control device, TV, Pad, etc. The complete authorization process is as follows:
2/7
1 FLOW DESCRIPTION
The device requests the interface to obtain the token used in the authorization pro-
cess, the interface is getQRCodeToken
Example:
tuyaSmart--qrLogin?token=AZc72de000-ec00-4000-9e51-b610fc300000
Generate QR code
Display the QR code generated from the above string on the screen of the device;
Obtain whether the authorization is successful from the server. If the authorization
is successful, the user information will be returned, jump to the application home
page, and enter the subsequent operation.
3/7
1 FLOW DESCRIPTION
The app scans the QR code on the device, resolves the token in the QR code, and
performs the authorization operation
1.5 Authorization
Send the parsed QR code to the Server to complete the authorization action.
4/7
2 INTERFACE DESCRIPTION
2 Interface description
Declaration
Parameters
Parameters Description
callback callback
Example
Declaration
5/7
2 INTERFACE DESCRIPTION
Parameters
Parameters Description
token token
callback callback
Code sample
Declaration
6/7
2 INTERFACE DESCRIPTION
Parameters
Parameters Description
token token
callback callback
Example
7/7