AppCheck:Firebase 数据库连接被服务器强制终止。无效的 appcheck 令牌 - 未安装 AppCheckProvider

问题描述 投票:0回答:1

我执行了以下所有步骤,但现在我无法连接到 Firebase,因为

Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Invalid appcheck token
。我在模拟器和真实设备上都遇到了同样的错误。另外,现在应用程序根本无法连接到 Firebase。我检查了我的一些其他应用程序,没有使用以下代码,所有这些应用程序都连接并工作正常。

所有步骤如下。

1-我遵循以下调试说明

D DebugAppCheckProvider:将此调试密码输入到允许列表中 在您项目的 Firebase 控制台中: 123a4567-b89c-12d3-e456-789012345678

2- 我转到

Firebase Console
>
AppCheck
>
Apps
> 单击
3 dots
上的
Android App
>
Manage debug tokens
>
Add debug token
> 粘贴到
123a4567-b89c-12d3-e456-789012345678
作为 Name 并用于 我按了
Generate token

当我运行我的应用程序时,我在 LogCat 中得到以下信息:

Enter this debug secret into the allow list in the Firebase Console for your project: XXXXXXXX-YYYY-ZZZZ-AAAA-XXXXXXXXXXXX
Detected invalid AppCheck token. Reconnecting (2 attempts remaining)
Detected invalid AppCheck token. Reconnecting (1 attempts remaining)
Detected invalid AppCheck token. Reconnecting (0 attempts remaining)
Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Invalid appcheck token

Error getting App Check token; using placeholder token instead. Error: com.google.firebase.FirebaseException: No AppCheckProvider installed.

3-然后我做了与上述相同的操作,但对于Name,我粘贴了XXXXXXXX-YYYY-ZZZZ-AAAA-XXXXXXXXXXXX,并为Value生成了另一个令牌:

4- 等级:

implementation(platform('com.google.firebase:firebase-bom:32.3.1'))
implementation("com.google.firebase:firebase-appcheck-ktx")
implementation("com.google.firebase:firebase-appcheck-debug")
implementation("com.google.firebase:firebase-appcheck-playintegrity")

5- 主要活动:

override fun onCreate(savedInstanceState: Bundle?) {
    installSplashScreen()
    super.onCreate(savedInstanceState)

    if (BuildConfig.DEBUG) {
        Firebase.appCheck.installAppCheckProviderFactory(
            DebugAppCheckProviderFactory.getInstance(),
        )
    } else {
        Firebase.appCheck.installAppCheckProviderFactory(
            PlayIntegrityAppCheckProviderFactory.getInstance(),
        )
    }
}

6- 在 Google Play 控制台中,我转到

The_Specific_App_Im_Using
>
Setup
>
App Signing
> 复制的 SHA-256 证书指纹

7- 我转到 Firebase 控制台 >

AppCheck
>
Apps
> 单击
Android App
> 单击
Play Integrity
> 从 Play 商店粘贴 SHA-256 证书指纹。

仅供参考,之前添加了另外两个 SHA-256 证书,我忘了为什么,但它与 RevenueCat 有关

android firebase kotlin google-play-console firebase-app-check
1个回答
0
投票
当我将 firebase

debug Secret 测试密钥 123a4567-b89c-12d3-e456-789012345678

 添加到问题步骤 2 的 
Value 部分时,出现以下错误:

调试令牌值必须是版本 4 UUID

这导致我将其添加到

Name 部分中,并为某个值生成一个令牌,该值已被接受。因为它被接受了,所以我对步骤 3 中在 Logcat 中打印的密钥做了同样的事情:Enter this debug secret into the allow list in the Firebase Console for your project: XXXXXXXX-YYYY-ZZZZ-AAAA-XXXXXXXXXXXX

,它也被接受了,但这也导致了问题。

在我遵循的任何方向中从未解释过的是,从步骤 3

Enter this debug secret into the allow list in the Firebase Console for your project: XXXXXXXX-YYYY-ZZZZ-AAAA-XXXXXXXXXXXX

 在 Logcat 中打印出来的令牌应该位于步骤 2 中的 
Value 部分。您可以添加您想要的任何名称想要在Name部分。这是一个例子

我不知道测试键

123a4567-b89c-12d3-e456-789012345678

有什么用,因为它不起作用。

© www.soinside.com 2019 - 2024. All rights reserved.