【问题标题】:How can I add authentication scope to a GET method on googles API?如何将身份验证范围添加到 google API 上的 GET 方法?
【发布时间】:2018-04-09 13:13:14
【问题描述】:

我制作了一个脚本,将我的 google 令牌交换为新的访问密钥。

现在,我想使用我的访问令牌检查 IAP 购买(以进行身份​​验证)。

谷歌文档 (https://developers.google.com/android-publisher/api-ref/purchases/products/get) 说我必须使用这个 GET 方法:

GET https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/products/productId/tokens/token

如何将我的 access_token 添加到此 url 以授权我的应用程序成功获取我需要的 GET 方法返回的数据?

我试过了:

"https://www.googleapis.com/androidpublisher/v2/applications/flarehubpe.xflare.flarehub/purchases/products/flarehubvip/tokens/fraudtoken_shouldfail" . "&access_token=" . $accessToken

但我得到了错误:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "required",
    "message": "Login Required",
    "locationType": "header",
    "location": "Authorization"
   }
  ],
  "code": 401,
  "message": "Login Required"
 }
}

我应该如何进行身份验证?我做错了什么?

【问题讨论】:

    标签: php android


    【解决方案1】:

    只需在请求的标头中添加您的 access_token 以及 url。

    示例:承载“您的 access_token”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-12
      • 2013-08-20
      • 1970-01-01
      • 2021-11-22
      • 1970-01-01
      • 2016-04-28
      • 2023-03-08
      • 1970-01-01
      相关资源
      最近更新 更多