¶ APP Full Interface List For APP QR Code Login
Authing provides a REST-based QR code login interface, which developers can call directly.
¶ Generate QR code
The interface will return the QR code ID (random) and the QR code link.
Example of generated QR code:
Use the online QR code decoding tool (opens new window) to view the QR code data as follows:
{
"scene": "APP_AUTH",
"random": "SzZrszCJNCFfVBDUCKLDtAYNBR96SK",
"userPoolId": "5fae2648201cfd526f0ec354",
"createdAt": "2020-11-13T06:23:25.396Z",
"expiresIn": 120,
"customData": {}
}
¶ Query the status of the QR code
Request result field description:
- status
- 0: The code is not scanned.
- 1: The QR code has been scanned but the user has not clicked to agree to authorize or cancel authorization. At this time, the user's avatar and nickname will be returned, but it does not contain other confidential information, which can be used for front-end avatar display.
- 2: User agrees to authorization
- 3: User cancels authorization
- -1: Expired
- userInfo:
- By default, after the user scans the code, it will contain two fields: nickname and photo
- Developers can also configure to return complete user information (including login credentials token)
- ticket: used in getting complete user information. **This field will only appear after the user agrees to the authorization. **See below for details.
¶ To get user information by ticket
Attention: By default, this interface is only allowed to be called on the server side,which needs to be initialized with the user pool key.
The default validity time of the ticket is 300 s.
Developers can modify in the Authing console (opens new window) basic configuration -> basic settings -> app QR code scanning login Web custom configuration. See the custom configuration item page for details.
¶ Mark the code scanned on APP
APP 端标记已扫码,标记扫码之后 Web 端将可以获取到当前用户的昵称和头像。
The APP needs to meet two conditions:
- User must be logged in
- The user's user pool ID matches the QR code user pool ID.
¶ Agrees to authorization on APP
The APP agrees to the authorization, and the scanned interface needs to be called before calling this interface.
The APP needs to meet two conditions:
- User must be logged in
- The user's user pool ID matches the QR code user pool ID.
¶ Cancel authorization on APP
To cancel authorization on the APP, you need to call the scanned interface before calling this interface.
The APP needs to meet two conditions:
- User must be logged in
- The user's user pool ID matches the QR code user pool ID.