Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Small Program Biocertification verifySignature


May 20, 2021 WeChat Mini Program Development Document


Table of contents


soter.verifySignature

This interface should be called on the server side, as detailed in the Service Side API.
This interface supports cloud calls. Developer tool version required . . . 1.02.1904090 (latest stable download)
wx-server-sdk >= 0.4.0

SOTER biometric key signature verification

How to call:

  • HTTPS call
  • Cloud calls

HTTPS call

The request address

POST https://api.weixin.qq.com/cgi-bin/soter/verify_signature?access_token=ACCESS_TOKEN

Request parameters

Property Type The default Required Description
access_token string Is The interface calls the credentials
Openid string Is User openid
json_string string Is The resultJSON field obtained through a successful callback from wx.startSoterAuthentication
json_signature string Is The resultJSONSignature field obtained through a successful callback to wx.startSoterAuthentication

Returns a value

Object

The returned JSON packet

Property Type Description
errmsg string The error message
errcode number Error code
is_ok boolean Verify the results

An example of a request

{
  "openid": "$openid",
  "json_string": "$resultJSON",
  "json_signature": "$resultJSONSignature"
}

Cloud calls

Cloud call is the ability provided by the small program Cloud Development to call WeChat open interfaces in cloud functions and need to be used in cloud functions via wx-server-sdk.

The interface method

openapi.soter.verifySignature
Permissions for the soter.verifySignature API need to be configured in config.json, details

Request parameters

Property Type The default Required Description
Openid string Is User openid
jsonString string Is The resultJSON field obtained through a successful callback from wx.startSoterAuthentication
jsonSignature string Is The resultJSONSignature field obtained through a successful callback to wx.startSoterAuthentication

Returns a value

Object

The returned JSON packet

Property Type Description
errMsg string The error message
errCode number Error code
isOk boolean Verify the results

Abnormal

Object

The exception thrown

Property Type Description
errMsg string The error message
errCode number Error code

The legal value of errCode

Value Description The lowest version

An example of a request

const cloud = require('wx-server-sdk')
cloud.init()
exports.main = async (event, context) => {
  try {
    const result = await cloud.openapi.soter.verifySignature({
        openid: '$openid',
        jsonString: '$resultJSON',
        jsonSignature: '$resultJSONSignature'
      })
    return result
  } catch (err) {
    return err
  }
}