Repository navigation
Closed
Labels
api: androidpublisherexternalThis issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
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,subscriptionIdandtokenparameters 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
googleapisversion: 34.0.0
Thanks for making it down here.
Reacted by Osman, Allan Chau, tinc2k, Yaroslav, Lyubomir Ganchev, purificant, Hamid Reza, Govind Rai, Karl, Marian and 3 more
Reacted by Abdul Samad
Metadata
Metadata
Assignees
Labels
api: androidpublisherexternalThis issue is blocked on a bug with the actual product.priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
lfreneda commentedon Dec 10, 2018
@fel-dev any updates?
luboganchev commentedon Feb 20, 2019
@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?
luboganchev commentedon Feb 21, 2019
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?
luboganchev commentedon Feb 22, 2019
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.
victorbadila commentedon Feb 26, 2019
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.
luboganchev commentedon Feb 26, 2019
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.
purificant commentedon Mar 9, 2019
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:
rogiervandenberg commentedon May 1, 2019
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.
28 remaining items
Iscalej commentedon May 9, 2021
Same issue whit lag! 🤡
maxanstey commentedon Jul 27, 2021
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
awsdataarchitect commentedon Aug 13, 2021
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 ?
zalito12 commentedon Dec 12, 2021
After more than 60 hours it still didn't work for me, I tryed this and it started working at the moment 😮
chore: Enable Size-Label bot in all googleapis NodeJs repositories (#…
chore: Enable Size-Label bot in all googleapis NodeJs repositories (#…
capthy commentedon Mar 24, 2023
We get resolved instantly by adding a new product.
Change & save existed products don't work for us.
anthalasath commentedon Jul 21, 2023
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.
aershov24 commentedon Nov 30, 2023
Confirming, that helped
fablau commentedon Feb 27, 2024
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.
dharmeshgigs commentedon Mar 16, 2024
Waiting for 24*2 hours. Not working for me. Any other possiblities? you would like to share.
PixelnomadsLtd commentedon Sep 5, 2025
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.
chrox commentedon Oct 21, 2025
Same here and updating the description of the subscription details did the trick.
almoayad-dev commentedon Aug 18, 2026
After many hours of trying and days of waiting, this seems to have done the trick