更新时间:2025-11-13 GMT+08:00
微信认证接口
接口功能
微信认证接口,用微信渠道上行接口认证。
接口鉴权
// 1)将token、timestamp、nonce三个参数进行字典序排序
ArrayList<String> validations = new ArrayList<>();
validations.add(verifyCode);
validations.add(timestamp);
validations.add(nonce);
Collections.sort(validations);
// 2)将三个参数字符串拼接成一个字符串进行摘要签名
try {
return SignatureEncryptUtil.getDigestByAlgorithm(joinStr(validations), algorithm);
} catch (NoSuchAlgorithmException e) {
log.error("Failed to generate signature");
throw new AiccCommonException(e);
}

sha1加密算法存在安全风险,请谨慎使用。
接口原型
请求方法 | GET | |
|---|---|---|
请求URL | https://ip:port/social/on/wechat/{channelId} | 其中,ip:port为对外暴露的nslb的ip和port, channelId为渠道id |
请求参数
参数名称 | 选取原则 | 参数类型 | 默认值 | 说明 |
|---|---|---|---|---|
Content-Type | 必选 | String | 无 | 固定填 application/json; charset=UTF-8。 |
参数名称 | 选取原则 | 参数类型 | 默认值 | 说明 |
|---|---|---|---|---|
nonce | 必选 | String | 无 | 随机数 |
signature | 必选 | String | 无 | 签名 |
echostr | 必选 | String | 无 | 随机字符串 |
响应参数
当调用本接口响应成功,response 无响应内容。
当调用本接口响应失败,则返回相应的状态码或者错误描述信息。
接口示例
- 请求示例
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
- 响应示例
Status Code: 500 response: "WeChatMessaging send failed"
父主题:wechat渠道

