我很难调用Google API。
我遵循了https://developers.google.com/android-publisher/authorization上列出的所有步骤。这包括
然后,为了调用purchases.subscriptions.get API,我使用了以下CURL命令:
(https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get)
curl -X GET "https://androidpublisher.googleapis.com/androidpublisher/v3/applications/{packageName}/purchases/subscriptions/{subscriptionId}/tokens/{token}" -H "Authorization: Bearer {access_token}" -H "Accept: application/json" --compressed
但是,我收到以下错误:
"error": {
"code": 401,
"message": "The current user has insufficient permissions to perform the requested operation.",
"errors": [
{
"domain": "androidpublisher",
"message": "The current user has insufficient permissions to perform the requested operation.",
"reason": "permissionDenied"
}
]
}
}
我已阅读并实施了其他职位建议的修改,如
我也尝试过通过https://developers.google.com/android-publisher/api-ref/rest/v3/purchases.subscriptions/get#authorization-scopes调用API,但仍然没有成功(得到错误)。
如果有人有任何建议,那将是非常感谢的。谢谢。
发布于 2020-11-12 18:27:37
我面临着一个类似的问题,问题在于我们在项目中所做的设置。
有关设置,请参考创建-播放-服务凭据。使用与创建应用程序内产品相同的主帐户。
确保您删除了前一个。
链接到,您的Play Developer帐户需要链接到。
1a.打开设置>开发人员帐户菜单并选择API access
1b.选择链接将您的播放帐户连接到Google项目
1c.同意的条款和条件
2.创建服务帐户下一步我们需要创建一个服务帐户。这是在Google控制台上完成的。
2a.选择Create
2b.创建服务帐户密钥凭据
2c.输入服务帐户的详细信息
2d。下载您的JSON凭据:
3.授予访问权限
3a.在“播放控制台”中,在新创建的服务帐户上选择“授予访问权限”
3b.授予以下权限:
3c.Click在底部邀请用户并发送邀请
您将被重定向到用户和权限,在那里您应该看到新创建的服务帐户是活动的。
发布于 2021-09-21 02:00:58
我也遇到过同样的问题。在我的例子中,我没有使用密钥文件(json )来访问Google上的授权服务帐户,同时在后端验证购买情况。我把错误的密钥文件换成了Google上的授权服务帐户,它现在运行良好。
https://stackoverflow.com/questions/64754883
复制相似问题