java.io.IOException: FIS_AUTH_ERROR in Android Firebase
Asked Answered
R

37

63

I'm getting following error with Firebase services.

 E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: FIS_AUTH_ERROR. Won't retry the operation.
 D/AndroidRuntime: Shutting down VM
    com.google.android.gms.tasks.RuntimeExecutionException: java.io.IOException: FIS_AUTH_ERROR
        at com.google.android.gms.tasks.zzu.getResult(Unknown Source:15)
        at com.myApp.MainActivity$2.onComplete(MainActivity.java:349)
        at com.google.android.gms.tasks.zzj.run(Unknown Source:4)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:237)
        at android.app.ActivityThread.main(ActivityThread.java:7804)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)
     Caused by: java.io.IOException: FIS_AUTH_ERROR
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:82)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:96)
        at com.google.firebase.iid.zzx.then(com.google.firebase:firebase-iid@@20.1.0:4)
        at com.google.android.gms.tasks.zzd.run(Unknown Source:5)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)

Here is the part of the code where crash occurs:

        FirebaseInstanceId.getInstance().getInstanceId().addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
            @Override
            public void onComplete(@NonNull Task<InstanceIdResult> task) {
                if (task.getResult() != null && task.isSuccessful()) {
                    // Get new Instance ID token
                    firebaseToken = task.getResult().getToken();
                    prefs.edit().putString("firebaseToken", firebaseToken).apply();
                    registerToken();
                }
            }
        });

The error occurs in onComplete. Here is firebase dependencies which I use:

    // FIREBASE
implementation 'com.google.firebase:firebase-analytics:17.2.3'
implementation 'com.google.firebase:firebase-messaging:20.1.2'
implementation 'com.google.firebase:firebase-appindexing:19.1.0'
implementation 'com.google.firebase:firebase-ads:19.0.0'
implementation 'com.google.firebase:firebase-crashlytics:17.0.0-beta01'

I found this issue on Github related with my crash but there is no conclusive solution at all. Does anybody encountered this kind of issue? Thanks in advance.

Note: I don't use Flutter however the error occurs without flutter too. Device is Samsung A51 with Android 10.

Note 2: Firebase removed firebase-core. Problem can be related with that.enter image description here

Runty answered 15/3, 2020 at 23:13 Comment(9)
If you have a bug report, please contact Firebase support with the details. support.google.com/firebase/contact/supportGarett
I'm not sure it's the bug or my mistake. I don't think it's my mistake. I just updated firebase dependencies and application started to crash. Both debug and release versions. Thanks god I didn't release it. Normally, it worked perfectly before updating gradle.Armure
If you don't have code to show that reproduces the problem, then there's nothing we can do. Firebase support can at least collect your data and try to work toward a solution.Garett
I added code already. I'm trying to get firebase token in my MainActivity and app crashes. Until I updated firebase dependencies, it worked perfectly. Crash occurs in onComplete part. I'm suspicious crash is related with firebase-core. Firebase removed it that's why I update dependencies.Armure
Okey I found a solution and posted it. There is some kind of bug in newer versions of firebase-messaging.Armure
Did you install Google Play Services in your devices?Inexplicit
Yes and I fixed my problem already. Problem is with library not code, not implementation. Currently it's work perfectly. Please check my answer below.Armure
Is there a way to reproduce this crash? I am seeing same Crashes in Firebase Crashlytics for some users. But I don't know how to reproduce them on Emulator or on my real devices. @AykutUludağReunion
I still face the issue on some random devices and no clue what to do.Maccarthy
R
31

Temporary but working solution. Just downgrade com.google.firebase:firebase-messaging:20.1.2 to com.google.firebase:firebase-messaging:20.1.0. Apperantly, there is some kind of bug in 20.1.1 and 20.1.2 versions. App doesn't crash anymore.

UPDATE (11.04.2020): I tested in com.google.firebase:firebase-messaging:20.1.5 and apperantly problem has been fixed.


UPDATE (26.04.2020):

I found a permanent solution. First upgrade firebase dependencies to com.google.firebase:firebase-messaging:20.1.6. After that download google-services.json from firebase. Replace it with the current one. After that build > clean project otherwise you can get

API key expired. Please renew the API key

error. There is no problem with the key, it's some kind of bug of Google. If you completed these steps, add following code into onCreate of your top Application class which is you declared in manifest at the application tag.

FirebaseOptions options = new FirebaseOptions.Builder()
        .setApplicationId("APP ID") // Required for Analytics.
        .setProjectId("PROJECT ID") // Required for Firebase Installations.
        .setApiKey("GOOGLE API KEY") // Required for Auth.
        .build();
FirebaseApp.initializeApp(this, options, "FIREBASE APP NAME");

You can found your app id in the firebase > project settings. Also if you're debugging, don't forget to add the debug SHA-256 key to firebase.

Now I don't get crash anymore. Firebase services work perfectly.

Runty answered 15/3, 2020 at 23:27 Comment(8)
This worked: com.google.firebase:firebase-messaging:20.1.0 This did not work so far: com.google.firebase:firebase-messaging:20.1.5Scutch
Works like a charm. Just a note, the ApiKey mentioned in the answer is Web API key from the consoleIngredient
also check your SHA-1 package in console.developers.google.com/apis/credentialsSmuggle
This seems to defeat the whole purpose of the google-services.json, doesn't it? I don't set the FirebaseOptions manually, because the json should do it for me.Lincoln
Doesn't work for me. I've fixed it with old-school way : firebase-messaging:20.1.0Asepsis
Also adding SHA-1 doesn't work, Firebase looks crazy with their updates.Asepsis
We discourage initializing Firebase and FirebaseOptions programmatically. Instead you should load your Firebase options from the google-services.json file. The reason is that some Firebase services require more than the three fields defined in the example above. || We also discourage using a custom name when initializing Firebase (in the above example "FIREBASE APP NAME"). The reason is that not all Firebase services support a non-default FirebaseApp. You should only do this if you use more than one instance of class FirebaseApp in your application (not standard).Flagman
Upgraded the firebase packages to the latest versions, clean the project using flutter clean, and it works.Confucianism
M
47

Important: The first proposal here might not be the best solution. Please read the update from 08.2022 below.

In short: One should look inside Google Cloud Console > APIs & Services > Credentials > API Keys, and take from there the right Android key (click on "SHOW KEY" on the right), then place it into the Firebase file google-services.json - api_key - current_key (as shown on the picture below).


All of a sudden the same error (FIS_AUTH_ERROR) appeared in one of my apps, where I use Firebase Cloud Messaging. Everything was working without any issues, and suddenly the app was not able to get the app/device token with getToken(). After hours of research I discovered something, which solved the problem for me. I decided to check the values in the file google-services.json to see if they match the corresponding parameters in the Firebase Console at the settings of my project. First I downloaded a brand new google-services.json, which I compared with the one I already had in my app's folder, and they both were simply the same without any difference. In the Firebase Console I was checking one by one the Project ID, the Project number, etc. When I got to the Web API Key its value looked quite similar to api_key from google-services.json, but still both values were different. Then I decided to edit the file, and in the place of api_key I've put the value from Web API Key. Then I've cleaned the project and rebuilt, and afterwards everything again started working just perfectly.

Add api key


Update 08.2022

After more than a year later I can confirm that the above is still valid. Though I decided to check the key restrictions in Google Cloud Console following the advise of Ambrose Bako. Then I discovered that the mess with the different keys available in my account is even bigger. api keys

The last key (Maps API key) is the one which gets into the Firebase file google-services.json. I've downloaded a fresh copy, and it is still the same, no change since then. Obviously this key has pretty tight restrictions, but it is intended to be used somewhere else (google maps flutter), and it works properly on its place.

Now guess what! The key which gets into Firebase as "Web API Key" is the first one - Android key (auto created by Firebase). I don't understand too much how different stuff is organized between Firebase and Google Cloud Console, but considering the name of the key, I though that the second one - Browser key (auto created by Firebase) - should find its place as "Web API Key" in Firebase.

Anyway in my particular case the Web API Key from Firebase worked properly in my google-services.json because it was actually the Android key which I needed. I'm writing all this because in some other cases it might not be exactly the same. So, if needed, one should look inside Google Cloud Console > APIs & Services > Credentials > API Keys, and take from there the right Android key (click on "SHOW KEY" on the right), then place it into the Firebase file google-services.json - api_key - current_key (as shown on the first picture above).

Mixedup answered 3/5, 2021 at 19:34 Comment(11)
Whoa! It was this for me ... I'm super surprised .. this must be a straight up google bug when they are generating the google-services.json?Umber
Man, you really saved my day! This bug is super strange and I wasted a lot of time trying to find the solution. Thanks!Upbraiding
it should config the credential on console.cloud... too? i just try this, solve the ioexception but still not works on firebase authSapiential
Weird it happened for me too. Had always thought the json downloaded from firebase would be the most realiable, but apparently not!Joanajoane
I struggled on this issue for weeks, you really saved my day!Armbruster
Commenting to say you also saved me. Don't know why the google-services.json file you download isn't up to dateZwieback
I don't think, that Value in the json file is the Project API key value. I think this value its get from Google Cloud Console -> Credentials - Api Keys -> value.Zacek
Right, that's a hack. It means that this "Web" token has less restrictions than the one it is using by default. Check Ambrose Bako answer. Open Google Cloud Console -> Credentials - Api Keys and make sure you have the right restrictions. In my case, the SHA1 certificate was incorrectHomologous
Thanks man for pointing this out.Optometrist
@Homologous In my case the problem was not because of wrong key restrictions in Google Cloud Console. Really, there was a wrong key in google-services.json. See my update above.Mixedup
Adding web api key solves the problem. Thank you Atanas!!Bing
P
36

All you have to do is just make the API key you are using has permission to the following APIs:

  1. Firebase Installations API
  2. Firebase Cloud Messaging API
  3. FCM Registration API
  4. Cloud Messaging

You can change the restrictions from your google cloud -> APIs & Services -> Credentials

Puleo answered 21/3, 2020 at 11:56 Comment(5)
Problem isn't related with that. I'm using Firebase since Google advertised it. I already fixed problem by downgrading library version. Please check below. Also when you download google-services.json, firebase giving these permissions automatically.Armure
@AykutUludağ: It is true that Firebase is setting these permissions automatically for new Firebase projects, but if the permissions have changed, Firebase will not update them after you download google-services.json config file. Thus, even though unlikely to be the problem, it does not hurt to check if the mentioned APIs are enabled and white-listed.Flagman
You may also need to add Identity Toolkit API permission tooPuleo
I guess I'm at a bit of a loss here - one I get to credentials page and select my service account, how then do I view the API access or add additional? I just see a broken "policy report" button and abilities to view and edit users and roles attached to the account.Lizzielizzy
I have no restrictions at all and I am still getting this error. Should I limit the key to the above restrictions?Wireman
R
31

Temporary but working solution. Just downgrade com.google.firebase:firebase-messaging:20.1.2 to com.google.firebase:firebase-messaging:20.1.0. Apperantly, there is some kind of bug in 20.1.1 and 20.1.2 versions. App doesn't crash anymore.

UPDATE (11.04.2020): I tested in com.google.firebase:firebase-messaging:20.1.5 and apperantly problem has been fixed.


UPDATE (26.04.2020):

I found a permanent solution. First upgrade firebase dependencies to com.google.firebase:firebase-messaging:20.1.6. After that download google-services.json from firebase. Replace it with the current one. After that build > clean project otherwise you can get

API key expired. Please renew the API key

error. There is no problem with the key, it's some kind of bug of Google. If you completed these steps, add following code into onCreate of your top Application class which is you declared in manifest at the application tag.

FirebaseOptions options = new FirebaseOptions.Builder()
        .setApplicationId("APP ID") // Required for Analytics.
        .setProjectId("PROJECT ID") // Required for Firebase Installations.
        .setApiKey("GOOGLE API KEY") // Required for Auth.
        .build();
FirebaseApp.initializeApp(this, options, "FIREBASE APP NAME");

You can found your app id in the firebase > project settings. Also if you're debugging, don't forget to add the debug SHA-256 key to firebase.

Now I don't get crash anymore. Firebase services work perfectly.

Runty answered 15/3, 2020 at 23:27 Comment(8)
This worked: com.google.firebase:firebase-messaging:20.1.0 This did not work so far: com.google.firebase:firebase-messaging:20.1.5Scutch
Works like a charm. Just a note, the ApiKey mentioned in the answer is Web API key from the consoleIngredient
also check your SHA-1 package in console.developers.google.com/apis/credentialsSmuggle
This seems to defeat the whole purpose of the google-services.json, doesn't it? I don't set the FirebaseOptions manually, because the json should do it for me.Lincoln
Doesn't work for me. I've fixed it with old-school way : firebase-messaging:20.1.0Asepsis
Also adding SHA-1 doesn't work, Firebase looks crazy with their updates.Asepsis
We discourage initializing Firebase and FirebaseOptions programmatically. Instead you should load your Firebase options from the google-services.json file. The reason is that some Firebase services require more than the three fields defined in the example above. || We also discourage using a custom name when initializing Firebase (in the above example "FIREBASE APP NAME"). The reason is that not all Firebase services support a non-default FirebaseApp. You should only do this if you use more than one instance of class FirebaseApp in your application (not standard).Flagman
Upgraded the firebase packages to the latest versions, clean the project using flutter clean, and it works.Confucianism
A
13

The correct fix is to add "Firebase Installations API" to the restrictions of your Google API Key (see google-services.json).

In your Google Cloud console, it's in APIs & Services, then Credentials. Open the API Key is look at "Restrictions".

No need to recompile.

Amoroso answered 16/4, 2020 at 13:51 Comment(2)
I can confirm that this is the right solutionCasares
it saved me a lot of time, thanks.Boodle
R
10

The FIS_AUTH_ERROR means Authentication for Firebase installation sdk has failed. If you use a service that depends on Firebase installation sdk (or FIS), you need a valid authorization.

According to Firebase cloud messaging v20.1.1 release note:

Apps that use the Firebase auto-initialization process and the Gradle plugin to convert google-services.json into resources are unaffected. However, apps that create their own FirebaseOptions instances must provide a valid API key, Firebase project ID, and application ID.

So if you (or a service using fcm added by you) uses FirebaseOptions, it has to pass some additional values for the FIS.

Solutions

  • Downgrade to v20.1.0 of firebase-messaging (Not recommended though. It's like running from the problem)
  • Provide additional keys if you use FirebaseOptions
Repugn answered 5/4, 2020 at 10:55 Comment(0)
D
10

In addition to Steeve's answer, the Firebase Messaging credentials should be restricted to these 3 Selected APIs:

Firebase Cloud Messaging API
Firebase Installations API
FCM Registration API

Go to the credentials on Google Cloud Console (APIs & Services -> Credentials), Click on the relevant key and select the 3 APIs above.

If you restrict usage to your Android apps, make sure to add SHA-1 fingerprints for your specific app. If you use internal app sharing, make sure to also add the SHA-1 of the internal app bundle as described here.

Delrio answered 18/8, 2020 at 9:33 Comment(4)
If the key is unrestricted should work as well? I have to restrict the key in order for it to work?Wireman
@rtsketo, you don't have to restrict but if you don't there's a chance someone will exploit it.Delrio
@Delrio For me it's very strange. I see FIS_AUTH_ERROR on Google Crashlytics as NON-FATAL exception, but when i test the notification with test device it works. I've cheked the SHA-1 keys for debug and release, and they are all fine and Added in Google Cloud Console. * I have only added App restrictions by SHA-1. * API restrictions -> NONE(Don't restrict key) These are my configuration and i can't find why i'm getting this error. It's from a half year maybe. I'am updating all the time versions and the error is keep showing. NOTE: I'm using Braze for push-notifications...Zacek
thanks for the tip about internal app sharing. I didn't know that had its own SHA-1 keyGoulette
C
10

If you have recently changed google-services.json file, you need to remove build file of your project and rebuild the project.

update: I got this error when I was testing my app in debug mode. In release version it was solved and worked correctly.

https://stacklearn.ir/course/android-introductory-training-course

Crumpet answered 30/5, 2021 at 17:59 Comment(1)
This fix my problem. Very similar to my issue. I changed google-services.json, and my android apps running in emulator went crazy with the issue. Deleting the build folder content, make Android Studio rebuild the whole content again.Brassware
B
7

I found a solution to this problem

1) in Android Studio , in left panel "Project" swich Android view to Project view

2) copy file google-services.json NOT into "app" folder (like it says in instruction) ... but copy this file into the upper root folder

and it will work

Boycie answered 17/6, 2020 at 8:45 Comment(1)
But... it does search for it in app directory :\Wireman
D
3

This is for sure, (if you finished all configuration) then version of firebase messaging is not compatible with other dependencies.

you can check dependencies here, my solution was to downgrade from implementation 'com.google.firebase:firebase-messaging:20.1.3' to implementation 'com.google.firebase:firebase-messaging:20.1.0'

Diastrophism answered 3/4, 2020 at 15:18 Comment(3)
@Sevyls: We do not consider this an issue and I don't think a future version will fix this for you. Please take a look at my answer below.Flagman
@AndreasRayoKniep thx, it resolved for me - SHA1 was missing in the API keyBarmaid
@Sevyls: Glad to hear! Atef Farouk, similar things will be true for you! Downgrading will not fix, but only avoid the issue for you.Flagman
F
3

@mahdi-malv, @ambrose-bako, @steeve are right.


Firebase Android SDK updates on February 27 (M65) and afterwards introduced a new infrastructure service, the Firebase Installations SDK which comes with a dependency on the Firebase Installations API.
Firebase Installations requires valid Firebase options API key, project ID, and application ID (a.k.a. "appId") in order to successfully communicate with Firebase servers.

Errors during communication with the Firebase Installations API indicate invalid Firebase options or misconfigurations regarding API keys.

To mitigate the issue

  • make sure that your application is using valid Firebase options from the latest google-services.json file from your Firebase console: Firebase options: instructions and background.
  • If you use API restrictions, make sure that the API key used by your application is white-listed for the Firebase Installations API (and for your application): API restrictions: instructions and background
  • Regarding Application restrictions: Either set the radio button to None or make sure that your app is white-listed (with the correct SHA-1 certificate).

For details, please visit:
https://firebase.google.com/support/privacy/init-options

Flagman answered 21/4, 2020 at 6:54 Comment(0)
S
3

I had fight with this exception almost 2 days, and now solved.

  1. First make sure the restrictions API as mentioned Ambrose's answer
  2. add ALL SHA-1 on firebase console and cloud console credential, in my case I need 4 SHA-1, from:
  • debug keystore
  • release keystore
  • firebase distribution (if using .AAB )
  • release certified from playstore's signing like this: enter image description here

I think add the last SHA-1 to cloud console make my app works nicely. Hope this answer will help other. Happy code!

Sapiential answered 11/12, 2021 at 8:20 Comment(3)
I've fallen into the same pitfall wondering why I get this error on debugging, forgot to allow debug SHA-1 fingerprints for my app. This will spit it out for you: keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass androidSolnit
there's also another SHA-1 for internal app sharing, as mentioned in @grebulon's postGoulette
Thanks it fixed my issue I run this command ./gradlew signingReport it will give the debug and release sha1, and also do the steps that zainal commented and add the sha1 to the credentials on google cloud consoleKearse
D
3

For me, it just was:

build > clean project

Because I was changing google-services.json file many times.

Dunfermline answered 17/5, 2022 at 19:37 Comment(0)
A
3

Complement to Steeve's answer

If your project uses Firebase and Google Maps API and you added Key restrictions to your API KEY you need to add Firebase Installations API to the API restrictions at the google cloud console

https://console.cloud.google.com/apis/credentials/key/

Firebase Installation API

Ario answered 23/2, 2023 at 23:12 Comment(0)
C
2

Just in case, renamed the package name, deleted google-services.json, and going into firebase checked firebase-database (read\write).

Then deleted the old package and its hash from the firebase project settings, after adding a new package and hash, received a new google-services.json, after that everything worked

I think the error is that a package was specified in firebase but there was no hash

Castor answered 27/6, 2020 at 17:38 Comment(0)
M
2

Hope this helps someone:

In my situation, I used self-signed ca. So I need to use network-security-config.xml

After huge try and error, finally I add system directory in trust-anchors like below, FIS_AUTH_ERROR is gone and Firebase worked.

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <base-config>
        <trust-anchors>
            <certificates src="system" />  <!-- for Firebase -->
            <certificates src="user" /> <!-- for tooling.   Ex:Charles --> 
            <certificates src="@raw/ca_1"/> <!-- my self-signed ca-->
        </trust-anchors>
    </base-config>
</network-security-config>
Myogenic answered 17/6, 2021 at 2:56 Comment(1)
Excellent! Exactly my problem, I've started using network-security-config, and couldn't understand what's wrong. Thanks a lotMylan
M
1

Maybe a bit late, but hopefully this info may help someone out there.

I had the problem too with firebase-messaging:21.0.1. I followed all the instructions given in this thread, but nothing helped.

What was curious is that before the error E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: FIS_AUTH_ERROR. Won't retry the operation appeared the logcat showed Firebase Installations Service is unavailable.

After some investigation the solution was as follows. I used a self-signed certificate on my dev-server and trusted it in my app as described here: https://developer.android.com/training/articles/security-ssl.html#CommonProblems
Somehow this broke the whole SSL handshake stuff in android and I couldn't authenticate to the Firebase Installations Service anymore. After removing this and using plain http for my dev environment everything works again like a charm. (of course, for my prod server I'm using a ROOT trusted certificate, so no problems here)

Macropterous answered 14/1, 2021 at 14:48 Comment(0)
M
1

it's very-very confused, how I search a soltion for this error (with FIS_AUTH_ERROR), but with @Andreas Rayo Kniep's answer, especially with CURL command test, I know what's wrong with my problem.

CURL command to test firebase conf : curl -H "content-type: application/json" -d "{appId: 'YOUR-APP-ID', sdkVersion: 't:1'}" https://firebaseinstallations.googleapis.com/v1/projects/PROJECT-NAME/installations/?key=API-KEY;

I must change API key at google-services.json, because it's status : PERMISSION_DENIED, message : Requests from referer are blocked.

so I create new API key from google console, with restrict API for : Cloud Messaging, FCM Registration API, Firebase Cloud Messaging API, Firebase Installations API. and application restriction : None.

and problem was fixed!

I use : com.google.firebase:firebase-messaging:20.1.0 firebase_messaging: ^10.0.2

Manassas answered 19/6, 2021 at 7:4 Comment(0)
C
1

Best solution worked for me is upgrading dependencies and clean & re-build project

Conversationalist answered 4/9, 2021 at 10:57 Comment(1)
I am getting this error only in few devices. Do you know how to reproduce this?Reunion
G
1

I had the same problem when I redownloaded Android Studio on a new computer. I hadn't set up Google Play services in my SDK Tools, and my emulator didn't have the Google Play store. See this discussion https://github.com/firebase/firebase-android-sdk/issues/1286#issuecomment-951403455

Also note that FirebaseInstanceId requires Google Play services to create a token and it will fail on devices without it.

After creating a new Emulator with Google Play and restarting my IDE, the problem was solved.

Germinate answered 20/12, 2021 at 21:51 Comment(0)
G
1
  1. Add the fingerprints from the play store.
  2. Replace the google-services.json.

It worked for me.

Genius answered 11/11, 2022 at 7:35 Comment(0)
E
1

For me it happend because api_key consist of more than one current_key in the google-services.json. And firebase sdk take first "current_key" from api_key array, which have not corresponding restriction in the google console.

how it was

To solve it, just remove all api_key exept your with correct restrictions

how i fixed

Enterprising answered 4/4, 2023 at 19:48 Comment(0)
C
0

you need to add

apply plugin: 'com.google.gms.google-services'

implementation platform('com.google.firebase:firebase-bom:x.x.x')
implementation 'com.google.firebase:firebase-analytics'

to your app/build.gradle , these code will give to you when create google.services file on firebase console

Clothier answered 15/4, 2021 at 8:32 Comment(0)
K
0

To remove this line:

FirebaseApp.initializeApp(getApplicationContext());

and let the SDK auto-initialize with the google-services.json solved it for me.

Kacykaczer answered 11/5, 2021 at 23:58 Comment(0)
Y
0

In my case Crashlytics reports this only on a few Samsung devices, I think this is something with how Google services are implemented on certain Samsung devices so there is not much you can do.

Youngling answered 23/6, 2021 at 2:49 Comment(1)
I have had a similar experience. I have thousands of users that have generated tokens just fine. However, I have logged the FIS_AUTH_ERROR three times and it has always been Samsung users. I don't think there is anything wrong with my set up as it is working for the other 15,000 users. If you get this error repeatedly, there is probably something wrong with your setup or configuration. If you only get see this error once or twice and you cannot reproduce, it might be a Samsung bug. If anybody has suggestions for things I could try, please let me know.Toothpaste
S
0

Tried all solutions above. They didn't work for me. But then I deleted the app from the device and installed again. This helped.

Shook answered 4/2, 2022 at 22:43 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Bewray
S
0

Method 1

Go to your google cloud console https://console.cloud.google.com/

Then choose your project and check auto-created by firebase token in credentials -> API keys. Select your key and check if there are any restrictions you have to configure. Clear the restrictions and again build your app newly.

Method 2

Check your fingerprints -> project settings -> in firebase console and cross check with your keystore file's fingerprint algorithms. Then download your new google-services.json file and replace it with your existing file in android/app

Spotty answered 22/3, 2022 at 9:56 Comment(0)
E
0

For me, I forgot we had implemented SSL pinning in the early stages of our app, so we had to download and trust the root Google Trust Services CA.

Thanks to this GitHub thread for reminding me to consider SSL pinning: https://github.com/invertase/react-native-firebase/issues/5522#issuecomment-884960850

I guess a good giveaway was that curl would work fine, but it would fail on Android.

Erk answered 26/4, 2022 at 21:45 Comment(0)
C
0

I was getting this error when I installed the application on my phone. The emulator did not give an error. I tried almost every solution, but in my case it was enough to delete the application, compile and build it again. I realized this after 1 day
My dependencies :

implementation platform('com.google.firebase:firebase-bom:26.4.0')
implementation 'com.google.firebase:firebase-crashlytics'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-analytics:17.3.0'
implementation 'com.google.firebase:firebase-installations:17.0.1'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation "com.google.firebase:firebase-core:16.0.8"
implementation "com.google.firebase:firebase-messaging:20.1.0"
Clomb answered 3/7, 2022 at 21:22 Comment(0)
J
0

After having tried all above suggestions, the only way I could fix this was to create a new Firebase project. The problem started for me after creating a new Angular Ionic project as a way to upgrade to Angular 14, Capacitor 4 and Ionic 6. Copying the same google-service.json to the new project (along with all src code files) and adjusting the package/applicationId in build.gradle and AndroidManifest.xml - created this issue. Anyways, as said, a 3 minutes new Firebase project process resolved everything eventually.

Jolley answered 18/8, 2022 at 11:9 Comment(0)
N
0

You should use the following code to obtain SHA 1 and SHA 256 and go to the Firebase panel and add new SHAs there and also download and replace the Firebase Jason file again and clean and rebuild the project. Do it and this way your problem will be solved. The code to get SHA is below. keytool -list -v -keystore "I:\AndroidProject\Busnet\example.jks" -alias example -storepass example -keypass example

Naiad answered 4/10, 2022 at 9:12 Comment(0)
N
0

My case solution:

  • remove other nodes from your google-services.json file except the one you need (from the 'client' array)

Explanation:

  • I don't have any access to the Firebase console of the project I have (nobody has now, it's fail)

  • I have old version google-services.json which work fine with the next libraries versions:

    Xamarin.Firebase.Config - 120.0.4 Xamarin.Firebase.Crashlytics - 117.4.1 Xamarin.Firebase.Dynamic.Links - 71.1615.4" Xamarin.Firebase.Iid - 71.1710.4 Xamarin.Firebase.Messaging - 71.1740.4

  • in this json I have 2 applications in the 'client' array (for some apps I have tens of them there)

  • after upgrading to Xamarin.Firebase.Analytics - 119.0.1.3 Xamarin.Firebase.Config - 121.0.1.3 Xamarin.Firebase.Crashlytics - 118.2.1.3 Xamarin.Firebase.Dynamic.Links - 120.1.1.3 Xamarin.Firebase.Iid - 121.1.0.3 Xamarin.Firebase.Messaging - 122.0.0.3" I can't receive the push token. And a lot of times I received this Fis-

Needlefish answered 15/3, 2023 at 7:9 Comment(0)
R
0

A small hint. Are you using an Ad-blocking VPN? If so - disable it or play with settings. In my case Ad Guard VPN blocked the traffic to Firebase assuming this is for serving ads ... Took me long time to discover the problem :(

Rebba answered 4/9, 2023 at 8:30 Comment(0)
H
0

I had this error in combination with:

java.lang.IllegalStateException: FirebaseApp name [DEFAULT] already exists!

For me the solution seems to be to give my Firebase app an "App nickname" in Project Settings -> General. It was always empty before and not needed, but when writing this it could maybe help someone.

Hydrokinetic answered 9/10, 2023 at 8:55 Comment(0)
S
0

After much struggle, creating multiple Firebase projects, and checking all configurations, I decided to debug the Firebase APIs with ProxyMan. I discovered that my IP address was on Google's block list. I resolved the issue by changing my IP with a VPN.

Sailboat answered 10/1, 2024 at 16:15 Comment(0)
K
0

I've been struggling with this for about a month, and hopefully won. So far, about 100000 users installed this app version and only a few had the FIS error. Here are my thoughts.

  1. I can’t believe that the Firebase console generates the wrong *.json. So I didn’t change anything in the google-services.json.
  2. My project level build.gradle.kts looked the different then the documentation suggested, so I changed strictry like documentation said with id("com.google.gms.google-services") version "4.4.0" apply false
  3. I have no sha-records in firebase console.
  4. In the google cloud console I added all fingerprints. I used this way to get all of them https://mcmap.net/q/303413/-android-how-to-get-sha1-md5-fingerprint-programmatically. Unexpectedly, there were more than just from google console.
  5. In the google cloud console I haven’t set any API restrictions.
  6. And super important: after uploading the apk/aab to the google play console I NEVER changed any firebase or google cloud settings.
Karolinekaroly answered 19/1, 2024 at 16:16 Comment(0)
D
-1

I started getting this all of a sudden when running integration tests on a local emulator. Turns out it had something to do with the hotel wifi I was on. I tethered to my phone and it started working again.

Dispute answered 15/10, 2022 at 12:53 Comment(0)
P
-4

sometimes it's too simple to be realized. in my case, that happened because of missing INTERNET CONNECTION

Platinum answered 16/10, 2022 at 15:16 Comment(1)
As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.Bewray

© 2022 - 2025 — McMap. All rights reserved.