# wx.authPrivateMessage(Object object)

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

with Promise style call: Not supported

Mini Program plugin: Not supported

Authenticate private messages. See for usage details Mini Program Private Message Usage Guide

# parameter

# Object object

attribute type Default values Required Introductions
shareTicket string yes shareTicket。 From wx.onShow Gets in the. details shareTicket
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# object.success callback

# parameter
# Object res
attribute type Introductions
errMsg string Error message
valid boolean Verification passes
encryptedData string After encrypting the activityId, decrypting to get the original activitityId. If the decrypted activityId can correspond to the developer's backstage activity id, then the verification is passed, otherwise the valid field is not reliable (tampered). See more.Encryption data decryption algorithm
iv string The initial vector of the encryption algorithm, seeEncryption data decryption algorithm

# sample code

wx.authPrivateMessage({
  shareTicket: 'xxxxxxx ', 
  success(res) {
    console.log('authPrivateMessage success', res)
    // res
    // {
    //   errMsg: 'authPrivateMessage:ok'
    //   valid: true
    //   IV: 'xxxx',
    //   encryptedData: Post posted: 'xxxxxx'
    // }
  },
  fail(res) {
    console.log('authPrivateMessage fail', res)
  }
})