簡體   English   中英

Firebase AppCheck 無法與 PlayIntegrity 提供程序一起使用

[英]Firebase AppCheck not working with PlayIntegrity provider

我遵循了 android 的 appcheck 設置指南,並在嘗試從應用程序中獲取令牌時遇到了以下問題:

FirebaseException: Error returned from API. code: 403 body: App attestation failed

如下調用 appcheck 時:

//initialize on app-start
FirebaseApp.initializeApp(applicationContext)
FirebaseAppCheck.getInstance().apply {
    installAppCheckProviderFactory(
        PlayIntegrityAppCheckProviderFactory.getInstance()
    )
}

//get token to then use in backend calls
firebaseAppCheck
    .getAppCheckToken(true)
    .addOnCompleteListener {
        //do something with the token
    }

由於 HTTP 403 (forbidden) 表明訪問權限配置錯誤,我已經按照文檔建議仔細檢查了配置,並想縮小問題可能所在的范圍,當我發現自己處於以下(奇怪的)情況時:

  • PlayIntegrityAppCheckProviderFactory更改為SafetyNetAppCheckProviderFactory后,我能夠檢索到令牌,這使我假設不是firebase訪問失敗,而是app integrity訪問失敗。
  • 以獨立的方式使用 play-integrity android 庫中的IntegrityManager我也能夠獲得一個 token ,這似乎與我的假設相沖突......

我在用

應用檢查: com.google.firebase:firebase-appcheck-playintegrity:16.1.0

獨立播放完整性: com.google.android.play:integrity:1.0.2 :integrity:1.0.2

任何人都知道這可能是什么原因?

如果您不是通過 Google Play 分發,則Play Integrity Provider 不適用於您的 Firebase 應用程序 另一個問題可能是注冊的 SHA-256 密鑰可能與 Google Play 用於簽署您的應用程序的密鑰不同。 我會驗證您正在使用來自 Play 商店的應用程序以及 Google Play 簽名的 SHA-256 指紋。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM