0

I'm trying to migrate from SafetyNet to Play Integrity API following googles documentation https://developer.android.com/google/play/integrity/verdict#request.
I'm building my request the same way they do in docs:

    Task<IntegrityTokenResponse> integrityTokenTask =
            integrityManager.requestIntegrityToken(
                            IntegrityTokenRequest.builder()
                                    .setCloudProjectNumber(CLOUD_PROJECT_NUMBER)
                                    .setNonce(Base64.encodeToString(NONCE_IN_BYTES, Base64.URL_SAFE | Base64.NO_WRAP))
                                    .build();

But when I'm trying to invoke token() on the result I get TOO_MANY_REQUESTS error even though I'm sending only one request.

integrityTokenTask.getResult().token();

An error occurred in main and is: -8: Integrity API error (-8): The calling app is making too many requests to the API and hence is throttled.

Play Integrity is properly set up in my Google Cloud Console.
Any ideas what I might be doing wrong?

JSob
  • 3
  • 3

2 Answers2

1

Play integrity API request quota is exhausted which is initially 10000 requests/day. You can check the daily used quota here. You have to fill out a request form to increase it. To request to change your app's usage tier, complete this form.

Saurabh
  • 449
  • 4
  • 9
0

Play Integrity API must be enabled in Google Play Console, not Cloud console, if your app is on-Play. Please, specify your console where you setup PIA.

  • PIA is integrated into a sdk in my case, app I'm using for testing isn't and will not be on Play which, according to [docs](https://developer.android.com/google/play/integrity/setup), means that for api to work I have to add my cloud project number to the request. – JSob Sep 23 '22 at 11:18
  • Yes, it is true. But to make it work in the app - the app also must have PIA enabled, see https://developer.android.com/google/play/integrity/setup#sdks. If you update Play store to latest version and try to call your SDK from app again - do you see the same error now or new one? Thank you! – Evgeniya Kotovich Sep 27 '22 at 10:13
  • Well app was connected to the play console, which I had no idea about. So enabling the API there was a solution. Other solution is to change applicationId in your build.gradle, if your app is on Play Console but you don't want to or simply don't have access to enabling Integrity. – JSob Sep 30 '22 at 07:35