title: Taro.getSetting(option)

sidebar_label: getSetting

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

Reference

Type

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

Parameters

Option

Property Type Required Description
complete (res: any) => void No The callback function used when the API call completed (always executed whether the call succeeds or fails)
fail (res: any) => void No The callback function for a failed API call
success (res: Result) => void No The callback function for a successful API call

SuccessCallbackResult

Property Type Description
authSetting AuthSetting Results of user authorization
errMsg string Call result

Sample Code

  1. Taro.getSetting({
  2. success: function (res) {
  3. console.log(res.authSetting)
  4. // res.authSetting = {
  5. // "scope.userInfo": true,
  6. // "scope.userLocation": true
  7. // }
  8. }
  9. })

API Support

API WeChat Mini-Program H5 React Native
Taro.getSetting ✔️