-1

I am trying to verify integrity using GooglePlayIntegrityAPI.

  1. pass the Nonce generated by the Android app to IntegrityAPI and get the token from IntegrityAPI (this was successful)
  2. send the token from the Android app to the App server
  3. App server queries Play`s server to decrypt & verify the token.
  4. Play`s Server returns token payload.

My problem is 3-4.(sorry, i made a mistake) Image

GoogleServer returns the following error to MyAppServer.

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

What is the cause? By the way, the Android app returns 400 Bad request (this is an error generated by Appserver, so it doesn`t really matter).

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

here is my code where GoogleIntegrityAPI called from AppServer(Not from My AndroidApp).

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();

thank you.

Mary
  • 11
  • 3
  • Please Show us the Code. It's pretty hard to troubleshoot this issue without seeing the use of the API itself. – GabeRAMturn Oct 19 '22 at 03:11
  • @GabeRAMturn I just update description. – Mary Oct 21 '22 at 02:41
  • is this Xamarin or something? How are you mixing C# with android exactly? Your using the .net client library not the java client library. – Linda Lawton - DaImTo Oct 24 '22 at 11:37
  • @DaImTo Its not Android app code, but my AppServer code. I want to verify the integrity, so as a last step, MyAppServer asks GoogleServer to decode the token. "Message": "App is not found." is the response from GoogleServer to MyAppServer. – Mary Oct 25 '22 at 09:05

1 Answers1

1

I got it! I had mistakenly passed the ApplicationID of my Android app as ApplicationName to the server side. ApplicationID and ApplicationName are in principle the same value, but I had added a suffix for Develop to ApplicationID. That's why it was App not found.

    productFlavors {
        create("aaa") {
            dimension = "default"
        }
        create("bbb") {
            dimension = "default"
            applicationIdSuffix = ".bbb"
        }
    }

I passed com.sample.myapp.bbb but I should use just com.sample.myapp.

thank you.

Mary
  • 11
  • 3