Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[firebase_messaging] Failed to get FIS auth token #2120

Closed
Stewioie opened this issue Mar 4, 2020 · 30 comments
Closed

[firebase_messaging] Failed to get FIS auth token #2120

Stewioie opened this issue Mar 4, 2020 · 30 comments
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: android Issues / PRs which are specifically for Android. plugin: messaging Stale Issue with no recent activity type: bug Something isn't working

Comments

@Stewioie
Copy link

Stewioie commented Mar 4, 2020

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 Stewioie added the type: bug Something isn't working label Mar 4, 2020
@schof
Copy link

schof commented Mar 6, 2020

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.

@JustinFincher
Copy link

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

@Stewioie
Copy link
Author

Stewioie commented Mar 9, 2020

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?

@iapicca iapicca added the impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) label Mar 9, 2020
@ofavre
Copy link

ofavre commented Mar 12, 2020

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.

@schof
Copy link

schof commented Mar 13, 2020

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.)

@JustinFincher
Copy link

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.

@aykutuludag
Copy link

aykutuludag commented Mar 15, 2020

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
Copy link

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

@iZooto-App-Push
Copy link

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

@sharmanitin0497
Copy link

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

@Sevyls
Copy link

Sevyls commented Apr 3, 2020

yes, here too - 20.1.4 also has this problem

@manojeeva
Copy link

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

@windows7lake
Copy link
Contributor

Still not fixed on 20.1.5

@Thrillhop
Copy link

Thrillhop commented Apr 17, 2020

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

@Ehesp Ehesp added platform: android Issues / PRs which are specifically for Android. plugin: messaging labels Apr 18, 2020
@andirayo
Copy link

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

@cyberpwnn
Copy link

cyberpwnn commented Apr 24, 2020

Still not fixed. Firebase is completely broken.

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

@anmolpandeyy
Copy link

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

but what about iOS?

@manojeeva
Copy link

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.

@schof
Copy link

schof commented May 8, 2020

@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?

@arlm1
Copy link

arlm1 commented Jun 5, 2020

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

@erlangparasu
Copy link

version 20.1.0 works! thank you!

@wangjianpeng
Copy link

wangjianpeng commented Jun 15, 2020

My gradle user versin with 'com.google.firebase:firebase-messaging:20.2.0',have this issue ,if 20.1.0 fix this issue ,why 20.2.0 still have the issue ?

@schof
Copy link

schof commented Jun 15, 2020

@wangjianpeng I have problems with both so I don't think it's completely fixed (at least not for all use cases.)

@applaru
Copy link

applaru commented Jun 17, 2020

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 in to "app" folder (like it says in instruction) ... but copy this file into the upper root folder

and it vill works

sorry i very bad speak english iam from Russia

my contacts is: appla.ru@mail.ru my personal site with contacts: appla.ru

@coskungun
Copy link

Hi everyone
After adding the codes related to fabric io, the problem was solved.

buildscript {
repositories {
jcenter()
google()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3'
classpath('io.fabric.tools:gradle:1.28.1')
}
}

allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }

    mavenCentral()
}

}

@bhallaramdhatarwal
Copy link

In my case error is

Firebase-Installations: Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
"error": {
"code": 403,
"message": "Requests from this Android client application com.axes.axestrack are blocked.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developer console API key",
"url": "https://console.developers.google.com/project/102453438543/apiui/credential"
}
]
}
]
}
}
]

FirebaseOptions options = new FirebaseOptions.Builder()
.setApplicationId("1:102453438543:android:27dcec4074a56618") // Required for Analytics.
.setProjectId("api-project-102453438543") // Required for Firebase Installations.
.setApiKey("AIzaSyBXWJ8Q-BTEzqe0tN5yRtOkBrAGrTwUKN0") // Required for Auth.
.build();
if(FirebaseApp.getApps(getContext()).isEmpty()) {
FirebaseApp.initializeApp(Objects.requireNonNull(getContext()), options, "AxesTrack");
}

        FirebaseApp.initializeApp(getContext());
        
        FirebaseInstanceId.getInstance().getInstanceId()
                .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
                    @Override
                    public void onComplete(@NonNull Task<InstanceIdResult> task) {
                        if (!task.isSuccessful()) {
                            Log.e("TAG", "getInstanceId failed", task.getException());
                            return;
                        }

                        // Get new Instance ID token
                        String token = Objects.requireNonNull(task.getResult()).getToken();
                        AxesTrackApplication.setRegistrationId(token, getContext());
                    }
                });

Gradle File below

// Add the Firebase SDK for Google Analytics
implementation 'com.google.firebase:firebase-analytics:17.4.4'

// Add the SDK for Firebase Cloud Messaging
implementation 'com.google.firebase:firebase-messaging:20.2.3'

Thanks

@iZooto-App-Push
Copy link

iZooto-App-Push commented Jul 26, 2020 via email

@pa2codes
Copy link

For me the issue was caused by setting the DNS of Android Emulator to 8.8.8.8. Ref -> https://medium.com/@cafonsomota/android-emulator-when-theres-no-connection-to-the-internet-129e8b63b7ce

@Cge001
Copy link

Cge001 commented Sep 25, 2020

i meet this problem. i try to solves it just like belowe:

old code:
Future setup() async {
...
pushToken = await PushManager.getInstance().getToken();
...
}

Future getToken() async {
try{
return await _firebaseMessaging.getToken();
} catch(error){
return '';
}
}

new code:
init() async {
getToken();
...
}

getToken() async {
try{
AppSetting.instance.pushToken = await _firebaseMessaging.getToken();
} catch(error) {
AppSetting.insatnce.pushToken = '';
}
}

conclusion:the different of the two coding style is the getToken() method have a async return type。
if i use the old code,run it will get an exception, meanwhile my android phone and iphone stop on the start screen,and serval minutes later show the home page.
i had try different methods to avoid the problem, and finally i test this method is ok...
that is new code, and run the new code i will get an exception too, but app will did not stop on the start screen. it's ok.

and i had found anther method is ok too, like this:

String tokenStr;
_firebaseMessaging.getToken().then((token) {
tokenStr = token;
}).timeout(Duration(seconds: 5), onTimeout: () {
tokenStr = '';
}).catchError((error) {
tokenStr = '';
}).whenComplete(() {
AppSetting.instance.pushToken = tokenStr ?? '';
});

@Salakar Salakar added the Stale Issue with no recent activity label Apr 1, 2021
@russellwheatley
Copy link
Member

Closing in favour of trying the latest messaging version which has been been heavily reworked, along with documentation, since this issue was raised: https://firebase.flutter.dev/docs/messaging/overviewIf you still have a problem please raise a new GitHub issue with up to date information and code snippets if possible. Thanks.

@firebase firebase locked and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
impact: crowd Affects many people, though not necessarily a specific customer with an assigned label. (P2) platform: android Issues / PRs which are specifically for Android. plugin: messaging Stale Issue with no recent activity type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests