May 20, 2021 WeChat Mini Program Development Document
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:
POST https://api.weixin.qq.com/cgi-bin/soter/verify_signature?access_token=ACCESS_TOKEN
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 |
The returned JSON packet
Property | Type | Description |
---|---|---|
errmsg | string | The error message |
errcode | number | Error code |
is_ok | boolean | Verify the results |
{
"openid": "$openid",
"json_string": "$resultJSON",
"json_signature": "$resultJSONSignature"
}
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.
openapi.soter.verifySignature
Permissions for the soter.verifySignature API need to be configured in config.json, details
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 |
The returned JSON packet
Property | Type | Description |
---|---|---|
errMsg | string | The error message |
errCode | number | Error code |
isOk | boolean | Verify the results |
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 |
---|
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
}
}