WeChat Channel Interface Authentication
Function
This interface is used for MO message authentication on WeChat.
Interface Authentication
// (1) Sort the values of token, timestamp, and nonce in alphabetical order.
ArrayList<String> validations = new ArrayList<>();
validations.add(verifyCode);
validations.add(timestamp);
validations.add(nonce);
Collections.sort(validations);
// (2) Concatenate the three parameter strings into a character string for digest signing.
try {
return SignatureEncryptUtil.getDigestByAlgorithm(joinStr(validations), algorithm);
} catch (NoSuchAlgorithmException e) {
log.error("Failed to generate signature");
throw new AiccCommonException(e);
}
The SHA1 encryption algorithm has security risks. Exercise caution when using this algorithm.
Interface Prototype
|
Method |
GET |
|
|---|---|---|
|
URL |
https://{IP address}:{Port number}/social/on/wechat/{channelId} |
{IP address}:{Port number} indicates the IP address and port number of the NSLB exposed externally. {channelId} indicates the channel ID. |
Request Parameters
|
Parameter |
Mandatory or Not |
Type |
Default Value |
Description |
|---|---|---|---|---|
|
Content-Type |
Yes |
String |
None |
The value is fixed at application/json; charset=UTF-8. |
|
Parameter |
Mandatory or Not |
Type |
Default Value |
Description |
|---|---|---|---|---|
|
nonce |
Yes |
String |
None |
Random number. |
|
signature |
Yes |
String |
None |
Signature. |
|
echostr |
Yes |
String |
None |
Random character string. |
Response Parameters
If this interface is invoked successfully, no response is returned.
If this interface fails to be invoked, the corresponding status code and error description are returned.
Example
- Request
POST /social/on/wechat/202105112580330807 Authorization: auth-v2/ak/2018-07-02T02:45:50Z/content-length;content-type;host/ ******************* Accept: */* Content-Type: application/json;charset=UTF-8 Content-Length: 193
- Response
Status Code: 500 response: "WeChatMessaging send failed"
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot