I have made a script that exchanges my google token for a fresh access key.
Now, I want to check a IAP purchase with my access token (to authenticate).
The google documentation (https://developers.google.com/android-publisher/api-ref/purchases/products/get) says I must use this GET method:
GET https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/products/productId/tokens/token
How do I add my access_token to this url to authorize my app to successfully get the data I need returned by the GET method?
I tried:
"https://www.googleapis.com/androidpublisher/v2/applications/flarehubpe.xflare.flarehub/purchases/products/flarehubvip/tokens/fraudtoken_shouldfail" . "&access_token=" . $accessToken
But I get the error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
How should I authenticate? What am I doing wrong?
Just add your access_token in the header of request along with url.
Example : Bearer "your access_token"