integritysafetynetgoogle-play-integrity-api

Play Integrity API token produces IntegrityErrorCode.html#TOO_MANY_REQUESTS


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?


Solution

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