首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Google返回400“找不到应用程序”。到服务器

Google返回400“找不到应用程序”。到服务器
EN

Stack Overflow用户
提问于 2022-10-13 07:21:31
回答 1查看 165关注 0票数 -1

我正在尝试使用GooglePlayIntegrityAPI来验证完整性。

  1. 将安卓应用程序生成的当前代码传递给IntegrityAPI,并从IntegrityAPI获得令牌(这是成功的)
  2. 将Android应用程序中的令牌发送到app服务器
  3. App服务器查询Play`s的服务器来解密和验证令牌。
  4. Play`s的服务器返回令牌有效负载。

我的问题是3-4。(对不起,我弄错了) 图像

GoogleServer将以下错误返回给MyAppServer。

代码语言:javascript
复制
"Code": 400,
"Message": "App is not found.",
"ErrorResponseContent": "
    {
        "error": {
            "code": 400,
            "message": "App is not found.",
            "errors": [
                {
                    "message": "App is not found.",
                    "domain": "global",
                    "reason": "badRequest"
                }
            ],
            "status": "INVALID_ARGUMENT"
        }
    }
"

原因是什么?顺便说一句,Android应用程序返回400坏请求(这是Appserver生成的错误,所以这并不重要)。

** UPDATE(2022/10/21) **

下面是我的代码,其中GoogleIntegrityAPI从AppServer(而不是从my AndroidApp)调用了

代码语言:javascript
复制
var credentialJson = "...credential json...";
var credential = GoogleCredential.FromJson(credentialJson)
                                        .CreateScoped(new[] { PlayIntegrityService.Scope.Playintegrity }).UnderlyingCredential;

var playIntegrityService = new PlayIntegrityService(new BaseClientService.Initializer()
{
    HttpClientInitializer = credential,
    ApplicationName = "...application name..."
});

var requestBody = new DecodeIntegrityTokenRequest
{
    IntegrityToken = "...token..."
};

var request = playIntegrityService.V1.DecodeIntegrityToken(requestBody, "...package name...");

var response = await request.ExecuteAsync();

谢谢。

EN

回答 1

Stack Overflow用户

发布于 2022-10-28 10:04:53

这样啊,原来是这么回事!我错误地将我的安卓应用程序的ApplicationID作为ApplicationName传递到服务器端。ApplicationID和ApplicationName在原则上是相同的,但是我为ApplicationID添加了一个发展后缀。这就是为什么应用程序没有被找到的原因。

代码语言:javascript
复制
    productFlavors {
        create("aaa") {
            dimension = "default"
        }
        create("bbb") {
            dimension = "default"
            applicationIdSuffix = ".bbb"
        }
    }

我通过了com.sample.myapp.bbb,但我应该只使用com.sample.myapp

谢谢。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74051874

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档