E
E
EVOSandru62020-12-11 15:22:34
G Pay
EVOSandru6, 2020-12-11 15:22:34

How to perform Oauth authentication on the server side and verify the purchase in purchases.products.get in GooglePay?

Hello guys, please advise.

If we validate a purchase in googlePay via:


purchases.products.get


GET https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/products/{productId}/tokens/{token}


It returns to me:

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential.
    Expected OAuth 2 access token, login cookie or other valid authentication credential.
    See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
      {
        "message": "Login Required.",
        "domain": "global",
        "reason": "required",
        "location": "Authorization",
        "locationType": "header"
      }
    ],
    "status": "UNAUTHENTICATED"
  }
}


I go to the specified link, I watch js examples.

But I need to validate the request on the server.

Do I understand correctly that I somehow need to authenticate through this Oauth and go to validate the request with the received token?

But on the current purchases.products.get page , there is nothing about A-la Authorization Token information. Which is strange.

There is a footnote at the bottom of the page:
Authorization Scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/androidpublisher


Additional information:
On the page
https://console.cloud.google.com/ (it also appears in https: //cloud.google.com/)
a project is started and there is a service account inside it.

The question is how and in what sequence to make this wonderful validation request and produce OAuth ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question