Skip to main content
Version: Next

Taro.getSetting(option)

Obtains the user's current settings. Only the permissions that have been requested by the Mini Program from the user are returned.

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.getSetting({
success: function (res) {
console.log(res.authSetting)
// res.authSetting = {
// "scope.userInfo": true,
// "scope.userLocation": true
// }
}
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getSetting✔️