尝试列出权利时:
403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "Insufficient Permission",
"reason" : "insufficientPermissions"
} ],
"message" : "Insufficient Permission"
}
我正在使用" WithInstalledApplication"使用client_secrets json进行授权。
重要提示:任何其他商家信息都正常运行(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());
感谢您的建议。
答案 0 :(得分:2)
最后,我找到了原因。
原因是范围设定问题 需要“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"