my.openSetting

Use this API to open the Mini Program settings page and returns permission setting results. Only the permissions that have been requested by the Mini Program from the user are displayed on the settings page.

Sample Code

copy
my.openSetting({
  success: (res) => {
    /*
     * res.authSetting = {
     *   "userInfo": true,
     *   "location": true,
     *   ...
     * }
     */
  }
})

Parameters

PropertyType

Required

Description
successFunctionNoThe callback function for a successful API call.
failFunctionNoThe callback function for a failed API call.
completeFunctionNoThe callback function used when the API call is completed. This function is always executed no matter the call succeeds or fails.

Success callback function

PropertyTypeDescription
authSettingObjectResults of user authorization. Keys are the values of scopes and values are boolean types, which shows whether the user gives the permission or not. See Scopes for details.

Scopes

ScopeAPIDescription
locationmy.getLocationThis field specifies whether to authorize access to geographic location. 
albummy.chooseImagemy.saveImageThis field specifies whether to authorize to save images to the albums.
cameramy.scanThis field specifies whether to authorize access to camera.
userInfomy.getOpenUserInfoThis field specifies whether to authorize access to user information.