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,
});
});
});

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.
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: