验证 Google 商店应用内购买需要哪些权限?
What permissions are required for validating Google Store In-App Purchases?
我正在尝试使用从客户端收到的令牌(内部发布)来验证用户购买。
为此,我将 Python 脚本与 Google Python API 客户端 (https://github.com/googleapis/google-api-python-client).
一起使用
import httplib2
from oauth2client.service_account import ServiceAccountCredentials
token = "token received from the client"
http = httplib2.Http(timeout=self.http_timeout)
credentials = ServiceAccountCredentials.from_json_keyfile_name(
"./service_account.json", "https://www.googleapis.com/auth/androidpublisher"
)
http = credentials.authorize(http)
result = build("androidpublisher", "v3", http=http)\
.purchases()\
.products()\
.get(packageName="<package name>", productId="<subscription id>", token=token)\
.execute(http=http)
我从这个电话中得到的回复是:
HttpError 401 when requesting https://www.googleapis.com/androidpublisher/v3/applications/<package name>/purchases/products/<subscription id>/tokens/<token>?alt=json returned "The current user has insufficient permissions to perform the requested operation."
正在使用的服务用户在 Google Play Console 中授予帐户管理员权限(为了测试),并在 "Google Cloud Console" console 中设置为 "Project Owner" (为了再次测试)。
这里好像出了什么问题?
'Owner' 权限足以进行收据验证 [Source]。
您遇到的错误很可能是传播问题,服务凭证实际上可能需要大约 24 小时才能在整个系统中生效。
我正在尝试使用从客户端收到的令牌(内部发布)来验证用户购买。 为此,我将 Python 脚本与 Google Python API 客户端 (https://github.com/googleapis/google-api-python-client).
一起使用 import httplib2
from oauth2client.service_account import ServiceAccountCredentials
token = "token received from the client"
http = httplib2.Http(timeout=self.http_timeout)
credentials = ServiceAccountCredentials.from_json_keyfile_name(
"./service_account.json", "https://www.googleapis.com/auth/androidpublisher"
)
http = credentials.authorize(http)
result = build("androidpublisher", "v3", http=http)\
.purchases()\
.products()\
.get(packageName="<package name>", productId="<subscription id>", token=token)\
.execute(http=http)
我从这个电话中得到的回复是:
HttpError 401 when requesting https://www.googleapis.com/androidpublisher/v3/applications/<package name>/purchases/products/<subscription id>/tokens/<token>?alt=json returned "The current user has insufficient permissions to perform the requested operation."
正在使用的服务用户在 Google Play Console 中授予帐户管理员权限(为了测试),并在 "Google Cloud Console" console 中设置为 "Project Owner" (为了再次测试)。
这里好像出了什么问题?
'Owner' 权限足以进行收据验证 [Source]。
您遇到的错误很可能是传播问题,服务凭证实际上可能需要大约 24 小时才能在整个系统中生效。