5

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.

Mark
  • 51
  • 2
  • I found a related question but slightly different question, have you taken a look at the email address associated with the account to ensure you have the relevant permission set in the store and dev console? See here:https://stackoverflow.com/questions/24287429/google-play-android-developer-api-401-insufficient-permissions – Joey Harwood Nov 13 '17 at 22:14

1 Answers1

2

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"
Alex K
  • 8,269
  • 9
  • 39
  • 57
jason cho
  • 21
  • 3
  • This worked for me. But I am only getting null as values `{"pageInfo":null,"resources":null,"tokenPagination":null,"ETag":"asdfasdfsdf""}` – Danjoa Jan 04 '18 at 11:48