Firebase app check with Play integrity not returning token giving 403 error GeneratePlayIntegrityChallenge are blocked

huangapple go评论79阅读模式
英文:

Firebase app check with Play integrity not returning token giving 403 error GeneratePlayIntegrityChallenge are blocked

问题

我已将 Firebase App Check 集成到我的 Android 项目中,并遵循了这里提到的所有必要步骤。此外,我还添加了以下设置代码:

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

另外,我还添加了以下代码来获取令牌:

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

我在调试应用程序中运行它,并按照此链接的指示将所有调试令牌添加到我的控制台。但问题是,我总是收到类似于以下的异常:

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

不确定我在这里做错了什么。我已经核对了我在 Firebase 控制台中添加的所有标识和 SHA 指纹,它们都是正确的。

英文:

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.

答案1

得分: 2

App Check 在内部使用 Android 密钥生成令牌。您可以在您的 Google 云控制台 Google 云控制台 中找到此 Android 密钥。
确保此密钥未受限制,并已允许 Firebase App Check API 使用该密钥。如果您未允许此操作,您将收到 google.firebase.appcheck.v1.TokenExchangeService.ExchangeDebugToken are blocked 错误消息。

Firebase app check with Play integrity not returning token giving 403 error GeneratePlayIntegrityChallenge are blocked

英文:

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.

Firebase app check with Play integrity not returning token giving 403 error GeneratePlayIntegrityChallenge are blocked

huangapple
  • 本文由 发表于 2023年5月25日 15:55:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/76330046.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定