Google Play Integrity DecodeIntegrityToken API的调试建议

huangapple go评论98阅读模式
英文:

Suggestions to debug Google Play Integrity DecodeIntegrityToken API

问题

使用Google的play-integrity API来验证随机数的使用方法。我遇到了这个障碍,不确定我可以尝试哪些其他方法来调试并获取有关此API的更多信息。以下是我目前所处的步骤序列。

我已经完成的工作:

在Google Cloud项目中创建了一个服务帐户,授权如下:

  • 服务帐户用户和服务使用者
  • 设置Google Auth默认凭证
  • 通过从服务帐户导入的JSON设置环境变量: GOOGLE_APPLICATION_CREDENTIALS。

我现在的进展:

  • 使用google-api-client构建和调用playintegrity,结果如下:

代码片段:

response = service.v1().decodeIntegrityToken(
  packageName='com.myapp.package',
  body={
    'integrityToken':'超长的字符串'
    }
).execute()

raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: <HttpError 400 when requesting
https://playintegrity.googleapis.com/v1/com.myapp.package:decodeIntegrityToken?alt=json
returned "Integrity token cannot be decoded due to invalid arguments.". 
Details: "Integrity token cannot be decoded due to invalid arguments.">

我尝试做的事情:

我试图更好地理解如何使用正确的参数或配置来调用decodeIntegrityToken以检索到200。目前对我来说不清楚其中的哪一部分是正确的,以及下一步的调试步骤是什么。

使用的资源:

英文:

Trying to figure out how to use Google's play-integrity api to verify nonces.
I've hit this roadblock and am unsure what other things I could try to debug and get more information out of this API. Below is a series of steps I've taken to get to the point I'm currently at.

What I've done:

Created a service account within the Google Cloud project with the grants:

  • Service Account User and Service Usage Consumer
  • Setup Google Auth Default Credentials
  • Set environment variable:GOOGLE_APPLICATION_CREDENTIALS by pulling down imported json from service account.

Where I'm at now:

  • Used google-api-client to build and call playintegrity, resulting in the response:

Code snippet:

response = service.v1().decodeIntegrityToken(
  packageName=&#39;com.myapp.package&#39;,
  body={
    &#39;integrityToken&#39;:&#39;superLongString&#39;
    }
).execute()

raise HttpError(resp, content, uri=self.uri)
googleapiclient.errors.HttpError: &lt;HttpError 400 when requesting
https://playintegrity.googleapis.com/v1/com.myapp.package:decodeIntegrityToken?alt=json
returned &quot;Integrity token cannot be decoded due to invalid arguments.&quot;. 
Details: &quot;Integrity token cannot be decoded due to invalid arguments.&quot;&gt;

What I'm trying to do:

I'm trying to better understand how to call decodeIntegrityToken with the right parameters or configurations to retrieve a 200. It is not immediately clear to me which of it is is and what the next steps to debug are.

Resources used:

答案1

得分: 1

如果您收到INTEGRITY_INVALID_ARGUMENT错误,请检查以下之一:

  • body_request中的参数不正确。
  • integrity_token,该令牌是在将nonce发送给Google后获得的。请注意,此integrity_token需要正确,否则仍将发送相同的错误消息。
英文:

If you are receiving an INTEGRITY_INVALID_ARGUMENT check one of the following:

  • arguments in body_request are incorrect.
  • integrity_token, which is retrieved by google upon sending over a nonce. Note that this integrity_token needs to be correct or else it will still send the same error message above.

huangapple
  • 本文由 发表于 2023年2月7日 04:02:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/75366025.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定