验证GoogleStoreInApp购买需要哪些权限?

2024-03-29 10:05:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用从客户端收到的令牌验证用户购买(内部版本)。 为此,我在googlepythonapi客户机(https://github.com/googleapis/google-api-python-client)中使用Python脚本。你知道吗

    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."

正在使用的服务用户在googleplay控制台中为帐户授予管理权限(为了测试),并在“googlecloud Console”控制台中设置为“Project Owner”(为了再次测试)。你知道吗

这里怎么了?你知道吗


Tags: 用户namefromhttpsimportcomclienttoken
1条回答
网友
1楼 · 发布于 2024-03-29 10:05:00

“所有者”权限足以接收验证[Source]。你知道吗

您遇到的错误很可能是传播问题,实际上需要约24小时服务凭据才能在整个系统中生效。你知道吗

相关问题 更多 >