简体   繁体   中英

FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch

I'm getting exception as

com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException: Firebase Installations failed to get installation auth token for fetch.

Can anyone tell me what's wrong with my code? I've initialised remote config like this

val firebaseRemoteConfig: FirebaseRemoteConfig by lazy { FirebaseRemoteConfig.getInstance() }

val firebaseRemoteConfigSettings = FirebaseRemoteConfigSettings.Builder()
        .setMinimumFetchIntervalInSeconds(0)
        .build()
firebaseRemoteConfig.setConfigSettingsAsync(firebaseRemoteConfigSettings)
    firebaseRemoteConfig.setDefaultsAsync(configDefault)
 if (NetworkConnectionHelper().connectionStatus(context)) {
        firebaseRemoteConfig.fetchAndActivate()
                .addOnCompleteListener { task: Task<Boolean?> ->
                    if (task.isSuccessful) {
                        setup()
                        Utils.log("remoteConfig Success.")

                    } else {
                        Utils.log("remoteConfig failed.")
                        setup()
                    }

                }
                .addOnFailureListener { exception -> Utils.log("remoteConfig exception: $exception") }
                .addOnCanceledListener { Utils.log("remoteConfig initAssetList: cancelled ") }
    } else {
        setup()
    }

What I've tried so far

  1. I've added SHA1 Key to Google Api & services, under "Restrict usage to your Android apps" section
  2. Uninstall and install the app.
  3. Added SHA1 key in firebase console.
  4. tried with only "fetch()" method of remoteconfig instead of fetchAndActivie().

but nothing help, I'm unable to fetch values from remote config.

I was also facing a similar issue on one of the devices and found out that that device is not having a google play store account logged in. When I tried the phone with a google play store account logged in, it worked. I wasted a few hours finding this. I hope if saves your time if facing the same issue.

Finally after spending whole day I found the mistake, it was my spell mistake in package name while adding SHA-1 in Google's api & services portal. Thanks anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM