Skip to content

Error 401 - insufficient permissions #22

@daniely-93

Description

@daniely-93

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions