Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Play Android Developer API - list entitlements - "Insufficient Permission"

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.

like image 488
Mark Avatar asked Oct 28 '22 23:10

Mark


1 Answers

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"
like image 188
jason cho Avatar answered Nov 09 '22 09:11

jason cho