SangminKim
SangminKim

Reputation: 9146

Google API 'Purchases.products: get' return 401 ERROR all of a sudden

Purchases.products: get had been working well till 2 weeks ago. However, it starts returning Error suddenly. (I didn't change any options)

It can still refresh token through POST request to https://accounts.google.com/o/oauth2/token with (grant_type, client_id, client_secret, refresh_token) but with the access-token returned, 403 Error happen like the below.

{
    "error": {
        "errors": [
            {
                "domain": "androidpublisher",
                "reason": "permissionDenied",
                "message": "The current user has insufficient permissions to perform the requested operation."
            }
        ],
        "code": 401,
        "message": "The current user has insufficient permissions to perform the requested operation."
    }
}

This is google dashboard representing error rate for Purchases.products: get

enter image description here

I found the question but it is still not working.

---------- EDIT ----------

I want to describe more detail. I don't know if it is right way because I am actually just fixing Legacy system someone did.

The process above(refreshing token and requesting purchase info) is done in server-side. It is for server-side to verify if the purchase-information APP send is correct.

When APP send purchase-information, server-side just call HTTP request(POST and GET) with pre-defined attributes(client_id, client_secret, grant_type).

It means there is no login process anywhere.

In addition, the client_id and client_secret I use seemed created in google-developer-console by create-credentials in below image but not when registering APP.

enter image description here

---------- Edit ----------

I tried to recreate client_id with an owner account. the screenshot is from google developer console->IAM&Admin->IAM

enter image description here

However, it is still the same error.

Upvotes: 0

Views: 1921

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117146

"The current user has insufficient permissions to perform the requested operation."

The user you have currently authenticated with no longer has access to the data you are trying to access. Either give the user access again or login with a user that does have access.

ClientId

When you wish to work with a Google API you must register your application. When you do so google gives you a client id. This identities your application to google when ever it runs.

Accessing User data

To access private user data you must have permission of the person who owns the data to access it. Your application runs (Denoted by the Client id) the user is prompted to login to google and grant your application consent to access their data.

If the user looses access to the data that they have granted your application access to your application will loose its access.

Upvotes: 1

Related Questions