User information capability

All the user information on the Mini Program Platform requires user's authorization. Based on the industry standard OAuth2.0 authorization mechanism, mini program developers can get user authorization to obtain user information.

Note: Developers must fully respect the privacy of users and properly use the user authorization. If the information is found to be used beyond the agreed scope or reasonable usage, Claro has the right to permanently withdraw the interface authority of mini program.

Prerequisites

  • This capability is open to merchants who have become business partners of the Claro.
  • Make sure that the integration and configuration have been completed and the mini program has been released.

Interaction process

Silence mode

The silence mode requires the user's consent on a native app to collect the required information. The interaction flow of the silence mode is illustrated as below:

image.png

  1. The user opens the Super App and is redirected to the merchant mini program.
  2. The merchant mini program calls the getAuthCode JSAPI to request authCode from the Super App.
  3. The Super App returns authCode to the merchant mini program, which sends authCode to the ISV or merchant server.
  4. With the obtained authCode in step 3, the ISV or merchant server calls the /v2/oauths/applyToken OpenAPI to request accessToken and uid from the super app server.
  5. The super app server returns accessToken and uid to the ISV or merchant server.

Notes:

  • authCode is used to exchange for accessToken. Every time the user authorization is completed, authCode in the JSAPI response is different. authCode can only be used once and will automatically expire within one day.
  • After the ISV or merchant obtains accessToken and uid:
    • The ISV or merchant can use accessToken to call other OpenAPIs. For example, call the inquiryUserInfo OpenAPI to query the user information.
    • The ISV or merchant can generate a session that maps to accessToken and uid, then set session expiration time and store the mapping. The session will be stored in the mini program framework.

User consent mode

The user consent mode is used to get public user information without further permission from the Super App. The interaction flow of the user consent mode is illustrated as below:

image.png

Get auth code

When the merchant mini program intends to get authCode for further usage, call the getAuthCode JSAPI by specifying the scope field.

API list

JSAPI

Description

my.getAuthCode

Gets user's authentication code.

OpenAPI

Description

/v2/authorizations/{apiName}

For details, see the Open APIs for Merchants chapter.

/v2/users/inquiryUserInfo

More information

Capabilities

JSAPIs

Open APIs

Developing Mini Program

Using Mini Program Platform

Features