1

I have integrated the firebase app check in my android project and followed all the requisites that are mentioned here. Additional to this I have also added the setUp code

        val firebaseAppCheck = FirebaseAppCheck.getInstance()
        val factory = if (BuildConfig.DEBUG) {
            DebugAppCheckProviderFactory.getInstance()
        } else {
            PlayIntegrityAppCheckProviderFactory.getInstance()
        }
        firebaseAppCheck.installAppCheckProviderFactory(factory)

Also the code below to fetch the token

            .getAppCheckToken(false)
            .addOnSuccessListener {token->
            }
            .addOnFailureListener { exception ->
            }

I am running it in debug app and have added all the debug token to my console by following this.

But the problem is I am always getting an exception like this

Error returned from API. code: 403 body: Requests to this API firebaseappcheck.googleapis.com method google.firebase.appcheck.v1.TokenExchangeService.ExchangeDebugToken are blocked.

Not sure what I am doing wrong here. I have crossed checked all the Ids and SHA-fingerprints that I have added to firebase console and they are all correct.

Rajat Beck
  • 1,523
  • 1
  • 14
  • 29

1 Answers1

2

Turns out that internally App Check uses an android key for token generation. You can find this Android key in your google cloud console google cloud console . Make sure that this key is not restricted and that you have allowed Firebase App Check API for that key. If you have not allowed this you will get the google.firebase.appcheck.v1.TokenExchangeService.ExchangeDebugToken are blocked.

Credentials view for google cloud console

Rajat Beck
  • 1,523
  • 1
  • 14
  • 29