Search code examples
google-playin-app-purchasegoogle-play-servicesservice-accountsgoogle-console-developer

Google receipt validation - 401 - permissionDenied


I want to make Google receipt validation. I set everything by Marc Greenstock. When I try verified purchase I get response permissionDenied. For me is everything correct and I don't know how to find a mistake. The user has administrator role in Google Play Developer console.

Google developer console:

  1. I enabled "Google Play Android Developer API"
  2. I created service account keys with role Owner
  3. I downloaded JSON file

Google play Developer console:

  1. Link correct project
  2. For correct user set administrator role. The same user is in the file.

Response:

{
  "code" : 401,
  "errors" : [ {
    "domain" : "androidpublisher",
    "message" : "The current user has insufficient permissions to perform the requested operation.",
    "reason" : "permissionDenied"
  } ],
  "message" : "The current user has insufficient permissions to perform the requested operation."
}

I tried friend private_key, client_id and client_email and everything works fine. Code is good. I something forgot during configuration but I don't know what.


Solution

  • I forgot to add scope ".../auth/androidpublisher" in Google developer console. enter image description here

    After you add scope you should save credentials at the bottom of page.