HMS IAP验证令牌返回令牌无效或已过期

发布于 2025-02-07 08:59:58 字数 912 浏览 3 评论 0 原文

我正在尝试验证我的购买(现在消耗品)。因此,我正在开发小型服务器应用程序。我发现了这个git软件包 hms iap Server in Democofig

in Democofig 脚本需要2个变量 客户端,客户端。我从App Gallery Connect Connect仪表板从Project设置 - >应用程序信息中获得。

pruchasing后,我正在写下我的购买令牌,我得到了我inapperpurchasedata.purchasetoken。

我要求从服务器到IAP服务器。它总是返回:

"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"

购买工作正在用于沙箱(测试),我正在尝试达到: https:https:https:https:https: //orders-at-dre.iap.dbankcloud.com

我不清楚哪个令牌已过期或无效?访问令牌还是我的购买令牌?

I am trying to validate my purchases(for now consumables). For this reason i am developing small server app. I found out this git package hms iap server demo

In DemoCofig script has need 2 variable
ClientId, ClientSecret. I getted from app gallery connect dashboard from Project Settings->App Information.
Dashboard Huawei

After pruchasing i am writing the console my purchase token which i getted InAppPurchaseData.PurchaseToken.

and i am requesting from my server to IAP Server. It always returning:

"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"

Purchasing job is working on SandBox(Test), I am trying to reach : https://orders-at-dre.iap.dbankcloud.com.

I am not clearly understand which token is expired or invalid ? Access Token or my purchase token ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄离 2025-02-14 08:59:58
"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"

该接口提示令牌无效或已过期。通常,令牌是一个访问权限(有效期为1小时,很短)。购买的有效期为30天。 (也有可能到期的可能性,但它的可能性比前者小得多)。

可能的原因如下:

  1. AT已过期。在这种情况下,需要再次获得AT(高概率)。
    API for Obtaining an App-等级访问令牌

  2. 格式(中概率)

    无效

请确保请求主体的格式在使用AT作为请求主体时正确。

根据请求标头指定身份验证信息。详细信息如下:

根据请求标头指定身份验证信息:
应用程序级访问令牌:授权:基本base64(appat:atvalue)

  • 示例:app级访问令牌是 thisisappatValue ,然后 appat:atvalue is appat:thisisappatValue

    因此,在 base64(appat:atvalue)中替换 appat:atvalue in “ appat:thisisappatvalue” 生成值== 。

    授权在请求标头中的值如下:基本QVBQVQ6DGHPC0LZQXBWQXRWYWX1ZQ ==

    有关详细信息,请检查


  1. puphaseToken与appid不符(低概率)。

  2. 站点请求错误(低概率)

您还可以参考,但它是中文,您可以翻译它。

"{\"responseCode\":\"6\",\"responseMessage\":\"Token is expired or invalid\"}"

This interface prompts that the token is invalid or expired. Generally, the token is an AccessToken (the validity period is 1 hour, AT for short). The validity period of the purchaseToken is 30 days. (There is also a possibility of expiration, but it is much less likely than the former).

The possible causes are as follows:

  1. The AT has expired. In this case, the AT needs to be obtained again (high probability).
    API for Obtaining an App-Level Access Token

  2. Invalid AT format (medium probability)

Ensure that the format of the request body is correct when the AT is used as the request body.

The authentication information is specified based on the request header. The details are as follows:

Authentication information is specified based on the request header:
App-level access token: Authorization: Basic Base64(APPAT:atvalue)

  • Example: The app-level access token is thisIsAppAtValue, then APPAT:atvalue is APPAT:thisIsAppAtValue.

    Therefore, replace APPAT:atvalue in Base64(APPAT:atvalue) with "APPAT:thisIsAppAtValue" to generate value QVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==.

    The value of Authorization in the request header is as follows: Basic QVBQQVQ6dGhpc0lzQXBwQXRWYWx1ZQ==

    For details check this docs.

  1. The purchaseToken does not match the appID (low probability).

  2. Site request error (low probability)

You can also refer to this forum similar questions, but it is in Chinese, you can translate it.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文