Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error 401 - insufficient permissions #22

Open
daniely-93 opened this issue Jul 25, 2021 · 9 comments
Open

Error 401 - insufficient permissions #22

daniely-93 opened this issue Jul 25, 2021 · 9 comments

Comments

@daniely-93
Copy link

daniely-93 commented Jul 25, 2021

I've set up a service account and linked it to Google Play, granted all the permissions including "View financial data" under "API Access" page.

{
    "isSuccessful": false,
    "errorCode": 401,
    "errorMessage": "The current user has insufficient permissions to perform the requested operation."
}

When I am trying to verify a purchase, it throws error 401 even though I been waiting 24 hours maybe until Google servers update.
When I call this get API with OAuth2 token, it works so the account has the permissions:
https://androidpublisher.googleapis.com/androidpublisher/v3/applications/com.my.package/purchases/products/<productId>/tokens/<purchaseToken>

Relevant code:

const Verifier = require("google-play-billing-validator");

const gpOptions = {
  email: gAccount.client_email,
  key: gAccount.private_key,
};

const verifier = new Verifier(gpOptions);

app.post("/verify", async (req, res) => {
  const { productId, purchaseToken } = req.body;
  verifier
    .verifyINAPP({
      productId,
      purchaseToken,
      packageName: "com.my.package",
    })
    .then((res) => res.status(200).json({ res }))
    .catch((error) => {
      res.status(500).send({
        success: false,
        error,
      });
    });
});

permissions

@ghost
Copy link

ghost commented Aug 24, 2021

Hi ! Found out the answer here: https://stackoverflow.com/questions/43536904/google-play-developer-api-the-current-user-has-insufficient-permissions-to-pe

@sandesh-bhoir
Copy link

Hi ! Found out the answer here: https://stackoverflow.com/questions/43536904/google-play-developer-api-the-current-user-has-insufficient-permissions-to-pe

is this verified solution?

@sandesh-bhoir
Copy link

@daniely-93 did you found a solution on this issue, I tried the stackoverflow solution but still the error persists.

@sandesh-bhoir
Copy link

It took me a waiting time for about 24 hours to get the permissions reflected. Modifying the subscription data didn't helped in force reflecting the permission changes. At the end it worked.

@premj-ekah
Copy link

Hi @daniely-93 @sandesh-bhoir, I'm getting the same issue even after 24 hours. Did you found a solution on this issue?

@sandesh-bhoir
Copy link

Hi @daniely-93 @sandesh-bhoir, I'm getting the same issue even after 24 hours. Did you found a solution on this issue?

The service account you had created needs to be added in https://play.google.com with the respective permissions as shared in screen above.

@premj-ekah
Copy link

Hi @sandesh-bhoir where to add service account in google play console, can you please share a link for google play console?

@sandesh-bhoir
Copy link

Hi @sandesh-bhoir where to add service account in google play console, can you please share a link for google play console?

They have mentioned steps in documentation. Do check step 4.

@premj-ekah
Copy link

Okay Thanks for your time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants