When trying to list entitlements am getting:
403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "Insufficient Permission",
"reason" : "insufficientPermissions"
} ],
"message" : "Insufficient Permission"
}
I am using "WithInstalledApplication" authorization with client_secrets json.
IMPORTANT: Any other listing is working correctly (apks, inappproducts, ... ). Am only having this issue with the entitlements.
I am also sure my source code is correct, but just for the reference:
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());
Thank you for your suggestions.
Finally, I found the reason.
The cause was a scope setting problem
need "https://www.googleapis.com/auth/googleplay.inapp.readonly" scope
I found it from Google OAuth 2.0 playground's response message:
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With