flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

[firebase_messaging] Failed to get FIS auth token

Open Stewioie opened this issue 6 years ago • 30 comments

Stacktrace

2020-03-04 12:41:39.805 25405-25554/packageName I/FirebaseAuth: [FirebaseAuth:] Preparing to create service connection to gms implementation
2020-03-04 12:41:39.905 25405-25405/packageName I/FirebaseInitProvider: FirebaseApp initialization successful
2020-03-04 12:41:42.652 25405-25557/packageName E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.0:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        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)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        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) 
2020-03-04 12:41:42.993 25405-25540/packageName E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: FIS_AUTH_ERROR. Won't retry the operation.
2020-03-04 12:41:43.616 25405-25557/packageName E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.0:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        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)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        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) 
2020-03-04 12:41:43.800 25405-25540/packageName E/FirebaseInstanceId: Topic sync or token retrieval failed on hard failure exceptions: FIS_AUTH_ERROR. Won't retry the operation.
2020-03-04 12:41:45.071 25405-25557/packageName E/FirebaseInstanceId: Failed to get FIS auth token
    java.util.concurrent.ExecutionException: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
        at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
        at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.0:54)
        at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.0:89)
        at com.google.firebase.iid.zzv.run(Unknown Source:12)
        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)
     Caused by: com.google.firebase.installations.FirebaseInstallationsException
        at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:333)
        at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
        at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
        at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
        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) 

Flutter doctor output

[√] Flutter (Channel stable, v1.12.13+hotfix.8, on Microsoft Windows [Version 10.0.18363.657], locale hu-HU)
    • Flutter version 1.12.13+hotfix.8 at C:\Work\Flutter
    • Framework revision 0b8abb4724 (3 weeks ago), 2020-02-11 11:44:36 -0800
    • Engine revision e1e6ced81d
    • Dart version 2.7.0

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at C:\Work\Android\SDK
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = C:\Work\Android\SDK
    • ANDROID_SDK_ROOT = C:\Work\Android\SDK
    • Java binary at: C:\Work\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)
    • All Android licenses accepted.

[√] Android Studio (version 3.6)
    • Android Studio at C:\Work\Android\Android Studio
    • Flutter plugin version 44.0.2
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] Connected device (1 available)
    • SM G965F • 279d5774421c7ece • android-arm64 • Android 10 (API 29)

• No issues found!
Process finished with exit code 0

Dependencies

dependencies:
  flutter:
    sdk: flutter

  flutter_screenutil:
  flutter_statusbarcolor:
  flutter_typeahead:
  flutter_webview_plugin:
  firebase_messaging:
  firebase_auth:
  diacritic:
  dio:
  json_annotation:
  shared_preferences:
  connectivity:
  flushbar:
  app_settings:
  uni_links:
  sqflite:
  permission_handler:
  location:
  google_maps_flutter:
  clippy_flutter:
  pull_to_refresh:
  url_launcher:
  date_format:
  fw_ticket:
  flutter_svg:
  path_provider:
  shimmer:
  modal_progress_hud:
  flutter_secure_storage:
  intl:
  device_info:

Stewioie avatar Mar 04 '20 11:03 Stewioie

Any idea what causes this? I just saw this today in a completely unrelated context (Google search results on FIS_AUTH_ERROR are surprisingly limited.

schof avatar Mar 06 '20 23:03 schof

Any idea what causes this? I just saw this today in a completely unrelated context (Google search results on FIS_AUTH_ERROR are surprisingly limited.

I am also in an unrelated context (Firebase Android SDK, not Flutter), but here is the stack trace of my error in case you need it. It seems like a networking issue.

14:13:10.32  6916  ERROR  FirebaseInstanceId  1  Failed to get FIS auth token
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  java.util.concurrent.ExecutionException: java.net.SocketTimeoutException: failed to connect to firebaseinstallations.googleapis.com/216.58.200.42 (port 443) from /192.168.0.39 (port 39964) after 10000ms
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzv.run(Unknown Source:12)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.lang.Thread.run(Thread.java:764)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  Caused by: java.net.SocketTimeoutException: failed to connect to firebaseinstallations.googleapis.com/216.58.200.42 (port 443) from /192.168.0.39 (port 39964) after 10000ms
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at libcore.io.IoBridge.connectErrno(IoBridge.java:201)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at libcore.io.IoBridge.connect(IoBridge.java:146)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:357)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.Socket.connect(Socket.java:616)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.Platform.connectSocket(Platform.java:145)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:141)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:237)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(Unknown Source:0)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.writeFIDCreateRequestBodyToOutputStream(com.google.firebase:firebase-installations@@16.0.0:178)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(com.google.firebase:firebase-installations@@16.0.0:152)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(com.google.firebase:firebase-installations@@16.0.0:411)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:316)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  ... 3 more

JustinFincher avatar Mar 09 '20 06:03 JustinFincher

Any idea what causes this? I just saw this today in a completely unrelated context (Google search results on FIS_AUTH_ERROR are surprisingly limited.

I am also in an unrelated context (Firebase Android SDK, not Flutter), but here is the stack trace of my error in case you need it. It seems like a networking issue.

14:13:10.32  6916  ERROR  FirebaseInstanceId  1  Failed to get FIS auth token
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  java.util.concurrent.ExecutionException: java.net.SocketTimeoutException: failed to connect to firebaseinstallations.googleapis.com/216.58.200.42 (port 443) from /192.168.0.39 (port 39964) after 10000ms
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.android.gms.tasks.Tasks.zzb(Unknown Source:61)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.android.gms.tasks.Tasks.await(Unknown Source:23)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzs.zzb(com.google.firebase:firebase-iid@@20.1.1:54)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzs.zza(com.google.firebase:firebase-iid@@20.1.1:89)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.iid.zzv.run(Unknown Source:12)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.lang.Thread.run(Thread.java:764)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  Caused by: java.net.SocketTimeoutException: failed to connect to firebaseinstallations.googleapis.com/216.58.200.42 (port 443) from /192.168.0.39 (port 39964) after 10000ms
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at libcore.io.IoBridge.connectErrno(IoBridge.java:201)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at libcore.io.IoBridge.connect(IoBridge.java:146)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:356)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:357)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at java.net.Socket.connect(Socket.java:616)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.Platform.connectSocket(Platform.java:145)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.io.RealConnection.connectSocket(RealConnection.java:141)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.io.RealConnection.connect(RealConnection.java:112)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:184)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:294)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:237)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:461)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:127)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getOutputStream(HttpURLConnectionImpl.java:258)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getOutputStream(DelegatingHttpsURLConnection.java:218)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getOutputStream(Unknown Source:0)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.writeFIDCreateRequestBodyToOutputStream(com.google.firebase:firebase-installations@@16.0.0:178)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.remote.FirebaseInstallationServiceClient.createFirebaseInstallation(com.google.firebase:firebase-installations@@16.0.0:152)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.registerFidWithServer(com.google.firebase:firebase-installations@@16.0.0:411)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.doRegistrationInternal(com.google.firebase:firebase-installations@@16.0.0:316)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.doGetId(com.google.firebase:firebase-installations@@16.0.0:280)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations.access$lambda$0(Unknown Source:0)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  at com.google.firebase.installations.FirebaseInstallations$$Lambda$1.run(Unknown Source:2)
14:13:10.32  6916  ERROR  FirebaseInstanceId  1  ... 3 more

Any further informations?

Device You tested and android version?

Stewioie avatar Mar 09 '20 08:03 Stewioie

I think you're hit by this: https://firebase.google.com/support/release-notes/android#messaging_v20-1-1 In Cloud Messaging version 20.1.1 changelog you can read:

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.

ofavre avatar Mar 12 '20 16:03 ofavre

For the record, we are using firebase messaging 20.1.2 and we use Gradle to to generate our google-services.json and I still saw this bug (although it seems to have been an isolated incident.)

schof avatar Mar 13 '20 11:03 schof

I am using the following Firebase libs:

    implementation 'com.google.firebase:firebase-messaging:20.1.2'
    implementation 'com.google.firebase:firebase-analytics:17.2.3'
    implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
    implementation 'com.crashlytics.sdk.android:crashlytics-ndk:2.1.1'
    implementation 'com.google.firebase:firebase-perf:19.0.5'

with a google-service.json downloaded from firebase web console (auto-init). The issue still presists. My guess is that this is a firewall-related issue (likely GFW's fault), as most of the incidents occur when the device is trying to establish a connection from China mainland.
As @Stewioie requested, I was using a Meizu 16th (Android 8.0) via online remote testing when getting this stack trace, but this applies to all kinds of brands, including OnePlus, Realme, Xiaomi, and Sony.

JustinFincher avatar Mar 15 '20 03:03 JustinFincher

Same error. I got the error in onComplete. com.google.android.gms.tasks.RuntimeExecutionException: java.io.IOException: FIS_AUTH_ERROR:

            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();
                    }
                }
            });

Here is firebase services I'm using:

    // 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'

aykutuludag avatar Mar 15 '20 22:03 aykutuludag

Solution: https://stackoverflow.com/questions/60698622/java-io-ioexception-fis-auth-error-in-android-firebase

aykutuludag avatar Mar 18 '20 06:03 aykutuludag

Change the
implementation 'com.google.firebase:firebase-messaging:20.1.0' then work perfectly

iZooto-App-Push avatar Mar 31 '20 06:03 iZooto-App-Push

Strange but even on StackOverflow, the solution is to change its version to 20.1.0. Just tested and it works.

sharmanitin0497 avatar Apr 03 '20 19:04 sharmanitin0497

yes, here too - 20.1.4 also has this problem

Sevyls avatar Apr 03 '20 19:04 Sevyls

Here too. Using Old firebase project issue comes on messaging.getToken() When creating a new project with firebase no issue.

manojeeva avatar Apr 08 '20 06:04 manojeeva

Still not fixed on 20.1.5

windows7lake avatar Apr 15 '20 08:04 windows7lake

Using 20.1.5 (and trying 20.1.0), but still getting the FIS_AUTH_ERROR.

app/build.gradle dependencies { implementation 'com.google.firebase:firebase-analytics:17.2.0' implementation 'com.google.firebase:firebase-messaging:20.1.5' implementation 'com.google.firebase:firebase-auth:19.3.0'...

Notifications.js let device_token = await firebase.messaging().getToken();

React Native Debugger Error: FIS_AUTH_ERROR at Object.fn [as getToken] (NativeModules.js:99) at Messaging.getToken (index.js:52) at _callee2$ (Notifications.js:64) at tryCatch (runtime.js:45) at Generator.invoke [as _invoke] (runtime.js:274) at Generator.prototype.<computed> [as next] (runtime.js:97) at tryCatch (runtime.js:45) at invoke (runtime.js:135) at runtime.js:170 at tryCallTwo (core.js:45)

Not sure if it's related to the errors found in my GCM: google.firebase.installations.v1.FirebaseInstallationsService.CreateInstallation

Thrillhop avatar Apr 17 '20 21:04 Thrillhop

To improve security 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. The used API key also has to be white-listed for the Firebase Installations API.

Errors during communication with the Firebase Installations API indicate invalid or unacceptable Firebase options. To mitigate the issue


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

andirayo avatar Apr 21 '20 06:04 andirayo

Still not fixed. Firebase is completely broken.

Not even using messaging, Doesnt work with firebase core, analytics only either.

cyberpwnn avatar Apr 24 '20 19:04 cyberpwnn

Change the implementation 'com.google.firebase:firebase-messaging:20.1.0' then work perfectly

but what about iOS?

anmolpandeyy avatar May 08 '20 06:05 anmolpandeyy

When I was checking in google-service.json, client key is wrong Checked google cloud platform for the correct key and replaced it. After that, it was working fine. I tried to download a new JSON file from firebase, still, I get the wrong key. There should be some problems in generating the JSON file.

  1. Check your client key in JSON and cloud platform android and ios key.
  2. Replace it.
  3. Rebuild the project. It started working fine. For those who have this problem maybe this could be the reason.

manojeeva avatar May 08 '20 11:05 manojeeva

@andirayo I'm still experiencing the issue with the latest fcm library (20.1.6) and I've double checked that we're using the latest google-services.json from the firebase console.

We are doing something a bit unusual in our case so I'm wondering if this is causing the problem. We set up a brand new firebase project since we were completely rebuilding our app from scratch. The APK still has the same Android name (package scheme) since we want users to be able to upgrade, etc.

We are getting lots of non-fatal error messages in Crashlytics where we report any failures to obtain the FCM token. Note that when I check our backend database later for the device in question we do see the token and we're able to message that device with the token. So it looks like it works eventually.

    private fun collectFcmToken() {
        if (fcmToken != null) {
            return
        }
        Log.debug("Collecting FCM token")
        val editor = preferences.edit()
        FirebaseInstanceId.getInstance().instanceId.addOnSuccessListener {
            Log.debug("Obtained FCM token ${it.token}")
            editor.put(FCM_TOKEN, it.token).commit()
            EventUtils.submitRecords()
        }.addOnFailureListener {
            Log.error("Failed to retrieve FCM token ${it.message}")
        }
    }

My hunch is that the FIS_AUTH_ERROR messages we're seeing are due to there being an existing FCM token associated with the old version of the app that is incompatible with the new google-services.json. Presumably we are then getting a new FCM token at that point which is why the application still appears to be working for the device. Does that sound possible?

schof avatar May 08 '20 17:05 schof

I had a similar issue with a native android app (without flutter). I was getting this error:

Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: {
      "error": {
        "code": 400,
        "message": "API key expired. Please renew the API key."...

I ended up fixing the issue by re-downloading the google-services.json and replacing it on my project. I am not sure why but the keys were different than my previous google-services.json

I have never had to re-download the .json file so I think Google re-generated the keys by some reason. Hopefully that helps someone in here

richardlm001 avatar Jun 05 '20 14:06 richardlm001