|
/

消息推送带emoji文案,签名错误

YYuri
发布于 4 年前
2176来自北京
消息推送 U-Push
API调用

求助各位大佬!

Java客户端调用Upush推送,body带emoji,接口返回2027 签名错误的错误码。

当request body中没有emoji时则签名正确,没有问题

使用Apache的签名库 DigestUtils.md5Hex() 方法计算签名

request body

{"appKey":"","timestamp":1659427127274,"type":"unicast","payload":{"body":{"custom":{"userId":6878630708848673920,"msgType":"TEST","title":"Hello world","subtitle":"hello world","content":"Go rockers! 🚀","jumpLink":"","createTime":1659455924736,"extra":{"test":"test"}}},"display_type":"message"},"device_tokens":""}

代码示例

return DigestUtils.md5Hex(
(HttpMethod.POST.name()
+ properties.getDomain()
+ toJson(payload)
+ uPushMeta.getAppMasterSecret()).getBytes(StandardCharsets.UTF_8)
2个回答
 
4 年前
来自上海

楼主排查一下签名的使用方式,以及设置值是否对

 
4 年前
来自浙江省

先检查一下计算签名时使用的编码方式和发送时是否一致,此外,就经验来看,为保证加密成功,AppMasterSecret 应选择其对应的值,确保App MasterSecret设置正确。

Loading ...
登录社区,分享你的经验