# wx.authorize(Object object)

Start from base library version 1.2.0. Please remaining backward compatible.

with Promise style call: Supported

Mini Program plugin: Not supported

Initiate authorization requests to users in advance. Immediately after the call, a pop-up asks if the user agrees to authorize the Mini Program to use a function or get some data from the user, but does not actually call the corresponding interface. If the user has previously agreed to the authorization, there will be no pop-up window, directly return success. For more information see User authorization。 &gt Mini Program plug-ins can be used wx.authorizeForMiniProgram

# parameter

# Object object

attribute type Default values Required Introductions
scope string yes Need to get permission Scope, see [scope list]((authorize#Scope - List))
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Interface calls the end of the callback function (call success or failure will be executed)

# sample code

// Can be passed wx.getSetting Check to see if the user is authorized "scope.record" this scope
  success(res) {
    if (!res.authSetting['scope.record']) {
        scope: 'scope.record',
        success () {
          // The user has agreed that the Mini Program will use the recording function, and then calls wx.startRecord Interface does not pop up to ask