All Products
Search
Document Center

SuperApp:Authorization introduction

Last Updated:Jul 05, 2025

Authorization Wake-up Method

Wake-Up Method

Composite Authorization

Comments

wv.authorize

This function is globally supported.

  • Get user device information.

  • Initiate an authorization request to the user in advance. After the JS-API invocation, a pop-up dialog will immediately prompt the user to confirm whether they agree to grant the miniapp permission to access specific device features (e.g., camera functionality) or retrieve device-related data (e.g., geolocation information). However, the corresponding API interface will not be triggered until explicit consent is obtained.

  • If prior authorization has been granted, the dialog won't reappear, and the function will return a success status immediately.

wv.getAuthCode

This function is globally supported.

  • Get user personal information.

  • Scope can be customized.

User Device Information Authorization By wv.authorize API

Preconditions

Preparations

  • When a miniapp invokes get-device-information-related APIs (such as WVLocation.getLocation, WVVideo.chooseVideo), the App must display an authorization prompt dialog requiring the user to decide whether to grant authorization to the current miniapp. miniapp developers can invoke wv.getSetting to check the current authorization status of the miniapp.

  • When using APIs that require authorization, users must complete authorization at two distinct levels:

    1. Authorize the miniapp within the App;

    2. Enable the corresponding permission at the system level and authorize it to the App;

  • The two levels of authorization status are independent of each other. If the miniapp has already obtained user authorization for accessing specific device information(such as location scope) , but the App itself hasn't acquired the corresponding system permissions, when the miniapp calls the corresponding JSAPI (such as WVLocation.getLocation), the miniapp container will automatically trigger a system dialog asking the user to confirm whether to grant permissions to the App. The miniapp can also use the WVUIDialog.showAuthGuide API to guide users to the system settings page to enable system permissions for the App.

Miniapp authorization related logic

When the miniapp has not been authorized by the user, calling a permission-requiring JSAPI requires first invoking wv.authorize. The App will then display an authorization prompt to the user:

  • If the user consents, the miniapp can proceed to invoke the device-information-related API to execute its functionality, and subsequent calls to this API will no longer trigger an authorization dialog;

  • If the user declines, the fail callback will be triggered immediately to indicate the authorization cancellation, and subsequent API calls will still prompt the user with an authorization dialog;

For APIs that require authorization and have not been authorized by the user for the miniapp, it is suggested to first use the wv.getting method to check, then call the wv.authorize method, and finally, call the API that requires authorization.

System-level permissions related logic

If a specific permission required by an API has not been enabled by the user in the system or granted to the app, even if the user consents to authorize this permission to the current miniapp, the API call will still fail. Typically, the miniapp's first call to this API will also trigger the App to request permission from the system, prompting the user with an authorization prompt or guidance screen. If the user rejects the request and selects 'Don’t ask again', the fail callback may be directly triggered. In this case, developers can invoke WVUIDialog.showAuthGuide to launch the system permission settings page and guide the user to manually enable the required permission for this App.

User Personal Information Authorization By wv.getAuthCode API

The wv.getAuthCode API guides users to authorize their personal information (e.g., name, contact information) to the current miniapp and displays an authorization dialog. It is recommended to invoke wv.getAuthCode API only after users have fully understood the miniapp's business content, avoiding its use on the miniapp's initial screen to prevent negatively impacting the user experience.

The authorization code (authCode) obtained via wv.getAuthCode API is subsequently used by the miniapp backend to exchange for actual user personal data (e.g., userId, avatar, nickname, phone number, nationality, gender, date of birth) from the SuperApp backend.

The Alibaba Cloud SuperApp Application Open Platform provides the API standard definition for wv.getAuthCode . However, since the open platform does not store user information of client SuperApps, the implementation of this API must be completed by the SuperApp developers. For reference, see: Best practices for implementing Superapp technical standards.

Scope-based permission control

A scope represents the permission range that miniapp must request from the user.

A scope indicates the scope of permissions that a developer must obtain from a user.

  • Scopes under permission management and control need to be explicitly defined.

  • Scopes related to sensitive information require authorization to be initiated by users.

Scope

API

Description

Triggering method

USER_ID

-

The developer is authorized to obtain the ID of the app user. No pop-up window is displayed during the authorization process.

Authorization API: wv.getAuthCode

USER_NICKNAME

-

The developer is authorized to obtain the nickname of the app user.

USER_NAME

-

The developer is authorized to obtain the name of the app user.

USER_LOGIN_ID

-

The developer is authorized to obtain the logon ID of the app user.

HASH_LOGIN_ID

-

The developer is authorized to obtain the hash value of the logon ID of the app user.

USER_AVATAR

-

The developer is authorized to obtain the avatar of the app user.

USER_GENDER

-

The developer is authorized to obtain the gender of the app user.

USER_BIRTHDAY

-

The developer is authorized to obtain the date of birth of the app user.

USER_NATIONALITY

-

The developer is authorized to obtain the nationality of the app user.

USER_CONTACTINFO

-

The developer is authorized to obtain the contact information of the app user.

auth_base

-

The developer is authorized to obtain the ID of the app user. No pop-up window is displayed during the authorization process.

auth_user

-

The developer is authorized to obtain the account information about the app.

location

WVLocation.getLocation |

WVLocation.searchLocation

Geolocation authorization

Authorization API: wv.authorize

camera

WVScan.scan

Camera authorization

bluetooth

WVBluetooth all methods

Bluetooth authorization

album

WVVideo.chooseVideo | WVCamera.takePhoto

Album authorization

contacts

WVContacts all methods

Contacts authorization

microphone

WVMotion.listenBlow |

WVMotion.stopListenBlow

Micrphone authorization

file

WVFile all methods 

WVVideo.saveVideoToPhotosAlbum  |

WVImage.saveImage

File authorization

call

WVCall.dial |  WVCall.call

Call authorization

vibrate

WVMotion.vibrate

Vibrate authorization

screen

WVScreenCapture.capture

Scren authorization