【问题标题】:Google Play Android Developer API - list entitlements - "Insufficient Permission"Google Play Android Developer API - 列出权利 - “权限不足”
【发布时间】:2018-04-17 09:14:06
【问题描述】:

当尝试列出获得的权利时:

 403 Forbidden                                                                                             

{
 "code" : 403,
 "errors" : [ {
 "domain" : "global",
 "message" : "Insufficient Permission",
 "reason" : "insufficientPermissions"
} ],
"message" : "Insufficient Permission"
}

我正在使用带有 client_secrets json 的“WithInstalledApplication”授权。

重要提示:任何其他列表都正常工作(apks、inappproducts、...)。我只是对权利有这个问题。

我也确定我的源代码是正确的,但仅供参考:

final AndroidPublisher service = AndroidPublisherHelper.init(appName, null);
final AndroidPublisher.Entitlements entitlements = service.entitlements();

EntitlementsListResponse entList = entitlements.list(pkgName).execute();
System.out.println("Entiltments: " + entList.toString());

感谢您的建议。

【问题讨论】:

  • 我发现了一个相关的问题,但问题略有不同,您是否查看了与该帐户关联的电子邮件地址以确保您在商店和开发控制台中设置了相关权限?见这里:stackoverflow.com/questions/24287429/…

标签: android google-play-services google-api-java-client google-play-console


【解决方案1】:

终于找到原因了。

原因是范围设置问题
需要“https://www.googleapis.com/auth/googleplay.inapp.readonly”范围

我是从 Google OAuth 2.0 Playground 的响应消息中找到的:

HTTP/1.1 403 Forbidden
Content-length: 208
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Mon, 01 Jan 2018 23:57:28 GMT
Vary: Origin, X-Origin
Server: GSE
-content-encoding: gzip
Cache-control: private, max-age=0
Date: Mon, 01 Jan 2018 23:57:28 GMT
X-frame-options: SAMEORIGIN
Alt-svc: hq=":443"; ma=2592000; quic=51303431; quic=51303339; quic=51303338; quic=51303337; quic=51303335,quic=":443"; ma=2592000; v="41,39,38,37,35"
Content-type: application/json; charset=UTF-8
Www-authenticate: Bearer realm="https://accounts.google.com/", error=insufficient_scope,         
scope="https://www.googleapis.com/auth/googleplay.inapp.readonly"

【讨论】:

  • 这对我有用。但我只得到 null 作为值 {"pageInfo":null,"resources":null,"tokenPagination":null,"ETag":"asdfasdfsdf""}
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-05-18
  • 1970-01-01
  • 2016-01-12
  • 1970-01-01
相关资源
最近更新 更多