Skip to main content
Version: 3.x

Taro.openSetting(option)

Opens the Mini Program settings interface on WeChat and returns setting results. Only the permissions that have been requested by the Mini Program from the user are displayed on the settings interface.

Note: As of the base library 2.3.0, only when the user taps at a specific location can the user be navigated to the settings page to manage authorization information. Details.

Reference

Type

(option?: Option) => Promise<SuccessCallbackResult>

Parameters

Option

PropertyTypeRequiredDescription
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackResult

PropertyTypeDescription
authSettingAuthSettingResults of user authorization
errMsgstringCall result

Sample Code

Taro.openSetting({
success: function (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.openSetting✔️