Huawei In App Purchase, implemented everything correctly but still getting the error : authorization format invalid

Huawei In App Purchase, implemented everything correctly but still getting the error : authorization format invalid

我正在尝试在我的应用程序中实施 Huawei in App Purchase kit。

我发送到服务器的请求在这里:

request {"purchaseToken":"0000017343ec91821b076fd75f71103a5a85595d2dfd245d708fd6058e676f857792b83622c7fd51x434e.1.100059717","productId":"1007"}

我在这里遵循这个指南:https://developer.huawei.com/consumer/en/codelab/HMSInAppPurchase/index.html#0

我正在执行相同的步骤,但是 我从服务器收到一条错误消息:

result: {"responseCode":"6","subErrCode":"211","responseMessage":"6-211-authorization format invalid"}

我哪一部分做错了?

在您遇到的错误中,显示“授权格式无效”。这意味着您的签名验证数据格式无效。可能的错误可能是:

  1. 请求头中的token未进行Base64加密
  2. 授权访问令牌前没有附加字符串APPAT。正确的访问令牌类似于 APPAT:thisIsAppAtVaule.

更多信息,请查看:https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/iap-FAQ

您在服务器端遇到问题。请通过给定的 link 了解更多关于 In App Purchase 服务器端和客户端的信息。

内购文章开发者论坛:

客户端:https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201255229704010231&fid=0101187876626530001

服务器端:https://forums.developer.huawei.com/forumPortal/en/topicview?tid=0201273064244120101&fid=0101187876626530001

应用内购买 Github Link :

客户端:https://github.com/DTSE-India-Community/HMS-In-App-Purchase-Kit

服务器端: https://github.com/DTSE-India-Community/Huawei-In-App-Purchase-And-Push-Kit-Server_Side-Implementation