tencent cloud

All product documents
Tencent Cloud Super App as a Service
Authorize
Last updated: 2025-02-24 17:10:38
Authorize
Last updated: 2025-02-24 17:10:38
Some APIs require user consent before they can be called. These APIs are divided into multiple scopes based on their usage. When a user grants authorization to a scope , all APIs corresponding to that scope can be used directly.
When calling such APIs:
If the user has neither accepted nor rejected the permission, a popup will ask for the user's consent. The API can be called only after the user agrees.
If the user has already granted permission, the APIs can be called directly.
If the user has rejected authorization, no popup will appear, and the API will directly enter the fail callback. Developers should ensure their applications handle scenarios where the user has denied permission.

Obtain user authorization status

Developers can use wx.getSetting to query the current authorization status of a user.

Open the settings page

Users can control the authorization status of the mini program in the settings page (accessible via the "..." menu in the top right corner).
Developers can call wx.openSetting to open the settings page and guide the user to enable authorization.

Initiate an authorization request in advance

Developers can use wx.authorize to initiate an authorization request to the user in advance before calling the authorization API.

Scope list

Scope
API
Description
scope.userInfo
User information.
scope.userLocation
Precise location.
scope.userFuzzyLocation
Fuzzy location.
scope.writePhotosAlbum
Saves to album.

Authorization validity

Once a user explicitly agrees to or rejects an authorization, the authorization status is recorded in the local cache until the user actively deletes the mini game.

Usage suggestions

Request authorization from the user only when you actually need to use the authorized API. Clearly explain the reason for needing the functionality in the authorization request.




Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback

Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support