Skip to content

service account with owner rights has insufficient permissions #1382

Closed

Description

Hello,

I finally managed to make a successful api call with this npm package;
publisher.inappproducts.list({ ... returns the expected result and everything is great.
But when I go for:

publisher.purchases.subscriptions.get({ 
  packageName: packageName, 
  subscriptionId: subscriptionId, 
  token: token
}) ...

It always returns the same error:
The current user has insufficient permissions to perform the requested operation.
Assuming that:

  • The current user is a service account with the highest possible permissions granted in both the developer console and the google play console. (including "view financial data")
  • The project in the google developer console is linked to the app in the google play console.
  • The packageName, subscriptionId and token parameters sent are valid.

What could possibly be missing?
Is a refresh_token needed with service accounts?
Could there be discrepancy between the permissions shown in the UI and the actual permissions granted to the service account?
Does the service account need to "accept" the invitation to be a "owner"?
Is there a way to list the service account's permissions through the API?

Here is the code I use for authentication:

const {google} = require('googleapis');

async function main () {
    // This method looks for the GCLOUD_PROJECT and GOOGLE_APPLICATION_CREDENTIALS
    // environment variables.
    const auth = await google.auth.getClient({
        // Scopes can be specified either as an array or as a single, space-delimited string.
        scopes: ['https://www.googleapis.com/auth/androidpublisher']
    });

    // obtain the current project Id
    const project = await google.auth.getProjectId();

    const publisher = google.androidpublisher({
        auth: auth,
        version: 'v3',
        project: project
    });
...

Environment details

  • OS: OSX 10.14 (Mojave)
  • Node.js version: 8.11.4
  • npm version: 5.6.0
  • googleapis version: 34.0.0

Thanks for making it down here.

Activity

  1. added
    triage me
    type: question
    and removed
    triage me
    on Oct 10, 2018
  2. lfreneda commented on Dec 10, 2018

    @lfreneda

    @fel-dev any updates?

  3. luboganchev commented on Feb 20, 2019

    @luboganchev

    @fel-dev I couldn't find any documentation that says "few days are required in order to propagate correctly the permissions". I also wrote an email to Google support asking a bunch of questions including this one but still no response from them. I did the same as you described in the issue - giving administrator permissions to my service account from both Developer console and the Google play console. Seems to be blocking issue with high priority since we are not able to validate in-app purchase within server side. Any updates what actually happens here?

  4. luboganchev commented on Feb 21, 2019

    @luboganchev

    Thanks for your help of course but how we can escalate this problem and some tech guy from Google to take a look at this blocking issue?

  5. deleted a comment from on Feb 21, 2019
  6. luboganchev commented on Feb 22, 2019

    @luboganchev

    Just to inform what's happening with my case. From the time when I setup full privileges to my service account to actual propagating the permissions from Google, it takes 24 hours. So if someone gives admin access to his/her own service account it should wait at least one day in order to verify In-App purchase from the server side. It will be great if Google representative document this behavior in order to be more transparent for further users.

  7. victorbadila commented on Feb 26, 2019

    @victorbadila

    any delay if this lagging happens for permission upgrades to other services as well? I am trying to setup domain wide delegation for connecting a service account with gsuite and ever though I followed every steps on every guide out there - Google wasn't very helpful in this regard - I still get unauthorized calls citing lack of permissions.

  8. luboganchev commented on Feb 26, 2019

    @luboganchev

    any delay if this lagging happens for permission upgrades to other services as well? I am trying to setup domain wide delegation for connecting a service account with gsuite and ever though I followed every steps on every guide out there - Google wasn't very helpful in this regard - I still get unauthorized calls citing lack of permissions.

    Probably for each Google service is implemented the same permissions propagating functionality with some Message Queue or Background Job running on some interval of time.

  9. purificant commented on Mar 9, 2019

    @purificant

    I had the same problem: The current user has insufficient permissions to perform the requested operation.

    It was resolved after waiting for 24-48 hours without touching the code. The same code / access key that was denied access previously suddenly started working. I am not exactly sure how long the wait has to be, in my experience it is closer to the 48h mark.

    P.S. My sample code in Python:

    import httplib2
    
    from googleapiclient.discovery import build
    from oauth2client.service_account import ServiceAccountCredentials
    
    credentials = ServiceAccountCredentials.from_json_keyfile_name('api.json', scopes='https://www.googleapis.com/auth/androidpublisher')
    
    http = httplib2.Http()
    http = credentials.authorize(http)
    
    service = build("androidpublisher", "v3", http=http)
    purchases = service.purchases()
    subscriptions = purchases.subscriptions()
    get = subscriptions.get(
        packageName='foo',
        subscriptionId='bar',
        token='baz'
    )
    result = get.execute()
    print(result)
    
  10. added
    status: investigating
    on Apr 18, 2019
  11. rogiervandenberg commented on May 1, 2019

    @rogiervandenberg

    I have found out that the issue is indeed not on the client side. I have a piece of code that works, but only once out of 4 times. Yesterday not at all. Perhaps tomorrow every time?

    Right now, frequently I get the The current user has insufficient permissions to perform the requested operation. message, and every once in a while I get the proper receipt validation. It seems that my service account is not fully propagated yet over all API handling servers somehow..

    Update one day later: I can verify, it now totally works as it should. So first, it did not work, then after a day or so every once in a while and now fully. So you need indeed 48h before your service account is fully working.

  12. 28 remaining items

  13. Iscalej commented on May 9, 2021

    @Iscalej

    Same issue whit lag! 🤡

  14. maxanstey commented on Jul 27, 2021

    @maxanstey

    In my case I had simply forgotten to link the Service Account with my Merchant Account. The documentation here is very clear and helpful, and the effect was immediate: https://developers.google.com/pay/passes/guides/basic-setup/get-access-to-rest-api

  15. awsdataarchitect commented on Aug 13, 2021

    @awsdataarchitect

    Hello, one question while comparing with Apple Receipt validation service. The apple service endpoint validates any receipt, does google allow validation of the payload from another users' app or its only for your own apps ?

  16. zalito12 commented on Dec 12, 2021

    @zalito12

    After I did some updates to my subscription products (try edit description of your product and save), I instantly get permission.

    After more than 60 hours it still didn't work for me, I tryed this and it started working at the moment 😮

  17. capthy commented on Mar 24, 2023

    @capthy

    We get resolved instantly by adding a new product.
    Change & save existed products don't work for us.

  18. anthalasath commented on Jul 21, 2023

    @anthalasath

    Still happens for me.

    I enabled Google Forms API for my service account, tried updating the project name and adding a new project, to no avail.

    I did not wait hours yet, but I would like to have a reliable solution to make it work immediately, this is quite inconvenient to use the API.

  19. aershov24 commented on Nov 30, 2023

    @aershov24

    Hi @Dhineshss and to everyone,

    One thing that helps me was to add another subscription product on play store developer console. After that, I was able to fetch the API using the service account I created linked and granted to the console.

    I hope this can help, or if not, you may try other suggestions.

    Confirming, that helped

  20. fablau commented on Feb 27, 2024

    @fablau

    Yes, as today 2/26/2024 I could use the trick of just updating the description of our of my in-app purchases items. It's absurd to rely on these workaround, and having "zzzzzzzzz" from Google. Their documentation sucks. Spent 8 hours to solve this issue.

  21. dharmeshgigs commented on Mar 16, 2024

    @dharmeshgigs

    Just to inform what's happening with my case. From the time when I setup full privileges to my service account to actual propagating the permissions from Google, it takes 24 hours. So if someone gives admin access to his/her own service account it should wait at least one day in order to verify In-App purchase from the server side. It will be great if Google representative document this behavior in order to be more transparent for further users.

    Waiting for 24*2 hours. Not working for me. Any other possiblities? you would like to share.

  22. PixelnomadsLtd commented on Sep 5, 2025

    @PixelnomadsLtd

    Hey!
    Had the same issue and waited over 48 hours. Updating the subscription description didn’t do anything. What finally worked was changing the prices of my sub, that did the trick. After that it worked right away.

  23. chrox commented on Oct 21, 2025

    @chrox

    Same here and updating the description of the subscription details did the trick.

  24. almoayad-dev commented on Aug 18, 2026

    @almoayad-dev

    What finally worked was changing the prices of my sub

    After many hours of trying and days of waiting, this seems to have done the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    api: androidpublisherexternalpriority: p2type: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions