# soter.verifySignature
Call this API at the server side. For more information, see Server API.
This API supports Cloud Calls. The WeChat DevTools version must be
1.02.1904090or later (download the latest stable version here), and thewx-server-sdkversion must be0.4.0or later.
Verifies the signature with a biometric authentication key of SOTER.
Calling methods:
# HTTPS Call
# Request Address
POST https://api.weixin.qq.com/cgi-bin/soter/verify_signature?access_token=ACCESS_TOKEN
# Request Parameters
| Attribute | Type | Default | Required | Description |
|---|---|---|---|---|
| access_token | string | Yes | Credentials to call API | |
| openid | string | Yes | The OpenID of the user. | |
| json_string | string | Yes | The resultJSON field obtained from successful callback of wx.startSoterAuthentication | |
| json_signature | string | Yes | The resultJSONSignature field obtained from successful callback of wx.startSoterAuthentication |
# Return Value
# Object
JSON data package that is returned
| Attribute | Type | Description |
|---|---|---|
| errmsg | string | Error message |
| errcode | number | Error code |
| is_ok | boolean | Verification result |
# Request Example
{
"openid": "$openid",
"json_string": "$resultJSON",
"json_signature": "$resultJSONSignature"
}
# Cloud Call
Cloud call is a capability provided by Mini Program·Cloud Base that allows you to call WeChat APIs in a cloud function. It must be used via
wx-server-sdkin the cloud function.
# API Calling Method
openapi.soter.verifySignature
You need to configure the permissions for the
soter.verifySignatureAPI viaconfig.json. Details
# Request Parameters
| Attribute | Type | Default | Required | Description |
|---|---|---|---|---|
| openid | string | Yes | The OpenID of the user. | |
| jsonString | string | Yes | The resultJSON field obtained from successful callback of wx.startSoterAuthentication | |
| jsonSignature | string | Yes | The resultJSONSignature field obtained from successful callback of wx.startSoterAuthentication |
# Return Value
# Object
JSON data package that is returned
| Attribute | Type | Description |
|---|---|---|
| errMsg | string | Error message |
| errCode | number | Error code |
| isOk | boolean | Verification result |
# Exceptions
# Object
Thrown Exceptions
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message |
| errCode | number | Error code |
Valid values of errCode
| Value | Description | Minimum Version |
|---|
# Request Example
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'
})
console.log(result)
return result
} catch (err) {
console.log(err)
return err
}
}