我制作了一个脚本,用于交换我的Google令牌以获取新的访问密钥。
现在,我想用我的访问令牌检查IAP购买(进行身份验证)。
Google文档(https://developers.google.com/android-publisher/api-ref/purchases/products/get)说我必须使用此GET方法:
GET https://www.googleapis.com/androidpublisher/v2/applications/packageName/purchases/products/productId/tokens/token
如何将我的access_token添加到此网址以授权我的应用成功获取GET方法返回的数据?
我试过了:
"https://www.googleapis.com/androidpublisher/v2/applications/flarehubpe.xflare.flarehub/purchases/products/flarehubvip/tokens/fraudtoken_shouldfail" . "&access_token=" . $accessToken
但我收到错误:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "required",
"message": "Login Required",
"locationType": "header",
"location": "Authorization"
}
],
"code": 401,
"message": "Login Required"
}
}
我应该如何进行身份验证?我做错了什么?