Reputation: 1181
I have a Google dev console process with Google Play Developer API is enabled and the project is linked to Google Play project. In Google Dev console project, created OAuth Client ID (web application) (I'm an owner of the project). Using "client_id" and "client_secret" to authenticate. Tried to using google-api-client in Python, Google Developer API Playground to send request to list reviews of our apps but got error: "The current user has insufficient permissions to perform the requested operation." Details as below: Request:
GET /androidpublisher/v2/applications/<package_name>/reviews
Response:
"error": {
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation.",
"errors": [
{
"domain": "androidpublisher",
"message": "The current user has insufficient permissions to perform the requested operation.",
"reason": "permissionDenied"
}
]
}
}
Did I miss anything?
Upvotes: 118
Views: 71479
Reputation: 3279
Editing a products name/price/description/status did not work for me, and neither did editing the apps title/description, but my store page was still saved as a draft.
I finished filling out the store page and saved it, and it immediately started working.
Google, you suck and I hate you, you wasted 6 straight hours and half my sanity, thinking I was just too stupid to understand how to configure your stupid service accounts. Turns out I was doing everything right. And instead of fixing these things you're just pouring all your money into AI, which has no purpose other than tricking investors. Google is a garbage company with garbage products.
Upvotes: 0
Reputation: 1337
Someone who still struggles in 2025 here, no AI tools comes up with this answer, so hooray for Stackoverflow! :)
What worked directly was to create a new placeholder subscription (This really needs to be in your doc, Google, no shame admitting this).
Tried, but didn't work (at least directly):
Upvotes: 0
Reputation: 151
Start by creating a Google Cloud account (you need to add a payment method - a card) Having an active Google Cloud account and an already uploaded and activated/certified app in the Google Play Console.
Having already created a product and/or subscription.
In my environment, once the above was done, I didn't have to wait at least 24 hours for it to work. It worked immediately.
When I changed the permissions from "Users and Permissions" in Google Play Console, it took a few minutes to change.
Upvotes: 15
Reputation: 4973
If you confirmed all steps and it not works, let try this step. It worked for me.
Actually any update on Subscriptions -> Plans/Offers should be a trick as well.
Upvotes: 1
Reputation: 51
On our project we had Google Play API working correctly. Then we transferred the project to a different account, which broke the permissions.
I tried giving permissions to the old service account, creating a new service account every time doing the trick with in-apps, or waiting 24 hours. Nothing worked.
Today I tried to disable the Android Developer API and enable it again after a while. That has fixed the issue for us.
Upvotes: 3
Reputation: 389
I was getting below response when verifying purchase using service account to call purchase API.
Status: 401, message: The current user has insufficient permissions to perform the requested operation.
The reason was that I not included the service account credentials in Google Play console. Settings -> Developer account -> API Access are now not showing on the Google Play Console.
So below are the steps I perform after that to get response from Purchase API:
1. In the Google Cloud Console go to Service Accounts and create.
2. Assign the Role.
3. Go to the Users & Permissions page on the Google Play Console and Click Invite new users.
4. Put an email address for your service account in the email address field.
5. Add an app to grant the permissions and then click on manage permissions.
6. Grant the necessary rights to perform actions and click Invite user.
To use the Google Play Billing APIs, you must grant the following permissions:
ā¢ View financial data, orders, and cancellation survey responses
ā¢ Manage orders and subscriptions
After these steps create or update the existing product/subscription name, country it will affect instantly without any delay. This is needed because you created product/subscription id before granting permissions.
Done
Upvotes: 7
Reputation: 161
In 2024: In My case it worked after adding the service account email in "Users and permissions" section of Google Play Console. I have Subscriptions not the products.
Important note: that we need to wait at-least 24hrs after adding the user in Google play console
Upvotes: 2
Reputation: 1552
For those that have been using the credentials without issues until a specific moment, and don't have access to the Play Developer Console, you must know that these keys expire. After re-enabling it, it will take some hours until it starts working again.
Upvotes: 0
Reputation: 51
Just in case someone stumbles upon this question, based on the information in this answer, it appears that Google has significantly altered the way service accounts access the Google Play Console. Notably, the "API Access" menu option seems to have been removed. During the billing setup, you might have noticed the requirement to grant permissions to your tester list, allowing them to make purchases while developing the in-app products feature. If you've followed all the steps correctly (which can be challenging, given the complexity and organization of Google's documentation), the service account email you created and added to the Google Play Console should also be included in your list of testers. You can find the License Testing section here.
Upvotes: 5
Reputation: 41
Yes, "Settings > Developer account > API Access" has disappeared in Google Play Console now! Instead, follow @BitQuestions instructions on inviting the service account user (email address of the service account) and grant the financial data permissions as per @Shivam Yadav
Also, @ihsanberahim tip was great to avoid 24hr delay in permissions propagation.
Upvotes: 3
Reputation: 1221
1.Go to Settings > Developer account > API Access
done
Upvotes: 0
Reputation: 851
Guys if your purchase API is giving error with The current user has insufficient permissions to perform the requested operation.
import { GoogleAuth } from "google-auth-library";
const client = new GoogleAuth({
keyFile: "./sql-play-pk.json",
scopes: "https://www.googleapis.com/auth/androidpublisher",
});
const packageName = "com.SqlPlay";
const productId = "premium";
const token = "your purchase token";
const purchaseUrl = `https://androidpublisher.googleapis.com/androidpublisher/v3/applications/${packageName}/purchases/products/${productId}/tokens/${token}`;
const res = await client.request({
url: purchaseUrl,
});
console.log(res.data);
Upvotes: 0
Reputation: 3
I was also struggling with the permissions issue. I went ahead a assigned app specific permission to the service account user:
Click Manage link on the user and you will see the following section on the next page
After selecting the app and clicking apply, you need to add the following permission
I tested immediately after applying those permissions and it was not working. But came back next day and it was working fine.
Upvotes: 0
Reputation: 8500
There is one important thing about receipt validation using Google Play Android Developer API:
If you added your in-app product BEFORE granting permission or linking to your service account, you must open "In-app products" and change something. You can for example edit the description of your product and save it. You should instantly get the permission then.
Upvotes: 257
Reputation: 760
For those who are still trying to find exactly where the permissions have to be set, once you already configured all the other things, you can reach that section following these steps:
As explained from previous comments, you only need to check "View app information and download bulk reports (read only)" and "View financial data, orders and cancellation survery responses", even if that makes no sense at all. Then wait for some hours, because not always the permissions get refreshed, even after following all the other suggestions. In my case, I waited overnight.
Upvotes: 0
Reputation: 31
Unfortunately for me, I didn't find the answer anywhere. The error still appeared. My problem got resolved when I changed the scope to: https://www.googleapis.com/auth/androidpublisher. This gives the correct OAuth credentials. After changing the scope, I started using the "purchases.subscriptionsv2.get" method (url: https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptionsv2/tokens/{token}?access_token=your_access_token) instead of purchases.subscriptions.get (url:https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}?access_token=your_access_token) . It was somehow screwed up and now everything works! I hope I helped to someone
Upvotes: 0
Reputation: 1173
Wait up to 24h OR create/edit any In-App product to force permission update,it takes 1-2 minutes to update and no need to wait 24h.
Upvotes: 10
Reputation: 1705
For my scenario:
If you are using service account to verify purchase via Google Play Developer API. Ensure you also click the View app information and download bulk reports (read only) permission besides the Financial data permissions.
After edited the permissions, update the in-app products and subscription (eg. change the descriptions).
Then wait for around 30 mins, the permission error gone. š
Upvotes: 8
Reputation: 781
It will automatically be fixed after 24 hrs, don't waster your time and energy with hacks, just wait and watch.
Upvotes: -3
Reputation: 1028
For someone who is facing this exact issue then the simple answer is to check the permissions to the service account which is linked in the Google Developer Console.
1.Open the Settings > Developer account menus and select API access 2.Choose the service account and check the permissions- REMEMBER FINANCE PERMISSION IS MUST FOR THIS ACTION
And after giving the permission update your subscription/package and make a new purchase then try again.
Happy Coding!
Upvotes: 7
Reputation: 4040
I faced a similar issue, the problem is in the settings we do in google developer project.
Refer to create-play-service-credentials for settings. Use the same primary account with which you created your in-app products.
Make sure you remove the previous one.
Link to a Google Developer Project Your Play Developer account needs to be linked to a Google Developer Project.
1a. Open the Settings > Developer account menus and select API access
1b. Select Link to connect your Play account to a Google Developer Project
1c. Agree to the terms and conditions
2. Create Service Account Next we need to create a service account. This is done from the Google API Console.
2a. Select Create Service Account
2b. Create Service account key credentials
2c. Enter details for service account
2d. Download your JSON credential:
3. Grant Access
3a. In Play Console, select Grant Access on the newly created service account
3b. Grant the following permissions:
After granting access, Google takes 24-48 hours to propagate all access rights for all API's, till that time you'll continue to get the same error.
Upvotes: 23
Reputation: 1150
For me the reason i had this issue because I did not check the permission to
Release to production, exclude devices and use app signing by Google Play
in Google Playstore console for the service account
I created to manage app creation and management.
So check Users and Permission
in the Google Play store console and check if the appropriate permission is checked.
Upvotes: 0
Reputation: 2591
If you followed all what @Bikram listed and you still facing the same error. Do this, create 'Managed product' temporary and then delete them. This way, sure you don't have to wait 24 hours.
It works for me.
Upvotes: 44
Reputation: 7985
Ensure you have done everything correctly as below.
Upvotes: 90
Reputation: 183
After adding a new user in the Google Play Console, Google needs up to 24 hours to propagate all access rights for all apis.
I ran into the same issue, when I've tried to using the oauth2 flow to access the Inapp purchases status api. It's not official documented, but this github comment helped me to figure this out.
Upvotes: 17
Reputation: 2139
I used service key and created it in Google APIs Credentials Cloud Platform, and I had the same issue until I added my created service key to Google Developer Console with all access.
I understood that you already created credentials in Google Developer Console, but maybe my experience will help someone else
Upvotes: 2