react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

[🐛] Bug Report Title - NativeFirebaseError: [messaging/unknown] FIS_AUTH_ERROR Android React-Native

Open Waleed-Nasir opened this issue 6 years ago • 34 comments

Issue

Facing this issue only in Android ,while IOS working perfectly , NativeFirebaseError: [messaging/unknown] FIS_AUTH_ERROR


Error Details

NativeFirebaseError: [messaging/unknown] FIS_AUTH_ERROR at FirebaseMessagingModule.getToken (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:173165:28) at HeaderHome.getToken$ (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:174261:77) at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1426:19) at Generator.invoke [as _invoke] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1602:24) at Generator.prototype. [as next] (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1469:23) at tryCatch (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1426:19) at invoke (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1502:22) at http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:1512:15 at tryCallOne (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:28905:14)

package.json:

# N/A

firebase.json for react-native-firebase v6:

# N/A

Package JSOn

Have you converted to AndroidX?

  • [*] my application is an AndroidX application?
  • [*] I am using android/gradle.settings jetifier=true for Android compatibility?
  • [ ] I am using the NPM package jetifier for react-native compatibility?

android/build.gradle:

// N/A

android/app/build.gradle:

// N/A

android/settings.gradle:

// N/A

MainApplication.java:

// N/A

AndroidManifest.xml:

<!-- N/A -->


Environment

Click To Expand

react-native info output:

 {
  "name": "My_app_name",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
   "@invertase/react-native-apple-authentication": "^1.1.2",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/cameraroll": "^4.0.1",
    "@react-native-community/google-signin": "^4.0.3",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/toolbar-android": "0.1.0-rc.2",
    "@react-native-firebase/app": "8.4.2",
    "@react-native-firebase/database": "^7.5.12",
    "@react-native-firebase/dynamic-links": "^7.5.10",
    "@react-native-firebase/messaging": "^7.8.4",
    "axios": "^0.19.2",
    "i": "^0.3.6",
    "jetifier": "^1.6.6",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.31",
    "native-base": "^2.13.14",
    "npm": "^6.14.8",
    "react": "16.11.0",
    "react-native": "0.62.1",
    "react-native-admob": "^2.0.0-beta.6",
    "react-native-chart-kit": "^5.6.1",
    "react-native-country-picker-modal": "^1.11.0",
    "react-native-draggable": "^3.3.0",
    "react-native-dropdown-picker": "^3.7.0",
    "react-native-easy-content-loader": "^0.3.2",
    "react-native-elements": "^1.2.7",
    "react-native-fbsdk": "^2.0.0",
    "react-native-fs": "^2.16.6",
    "react-native-gesture-handler": "^1.8.0",
    "react-native-iap": "^4.6.3",
    "react-native-image-picker": "^2.3.4",
    "react-native-image-resizer": "^1.3.0",
    "react-native-iphone-x-helper": "^1.3.0",
    "react-native-loader-overlay": "^1.0.0",
    "react-native-modal": "^11.5.6",
    "react-native-photo-upload": "^1.3.0",
    "react-native-popover-view": "^3.0.4",
    "react-native-push-notification": "^5.1.1",
    "react-native-push-notification-popup": "^1.6.0",
    "react-native-reanimated": "^1.10.0",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.11.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-select-input-ios": "^2.0.5",
    "react-native-share": "^3.8.5",
    "react-native-simple-dialogs": "^1.4.0",
    "react-native-simple-toast": "^1.1.3",
    "react-native-svg": "^12.1.0",
    "react-native-swipe-gestures": "^1.0.5",
    "react-native-swiper": "^1.6.0",
    "react-native-switch-toggle": "^1.1.4",
    "react-native-vector-icons": "^6.7.0",
    "react-native-video": "^5.1.0-alpha8",
    "react-native-view-shot": "^3.1.2",
    "react-native-webp-format": "^1.1.2",
    "react-navigation": "^4.4.2",
    "react-navigation-drawer": "^2.5.2",
    "react-navigation-stack": "^2.8.4",
    "react-navigation-tabs": "^2.9.2",
    "react-redux": "^7.2.1",
    "redux": "^4.0.5",
    "redux-logger": "^3.0.6",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "@babel/core": "^7.12.3",
    "@babel/runtime": "^7.12.1",
    "@react-native-community/cli-debugger-ui": "4.7.0",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "eslint": "^6.5.1",
    "jest": "^24.9.0",
    "metro-react-native-babel-preset": "^0.58.0",
    "react-test-renderer": "16.11.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

  • Platform that you're experiencing the issue on:
    • [x] iOS
    • [x] Android
    • [ ] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [x] Both
  • @react-native-firebase/app version you're using that has this issue:
    • 8.4.6
  • Firebase module(s) you're using that has the issue:
    • e.g. Instance ID
  • Are you using TypeScript?
    • N & VERSION


Waleed-Nasir avatar Oct 28 '20 15:10 Waleed-Nasir


    "@react-native-firebase/app": "^8.4.6",
    "@react-native-firebase/database": "^7.5.12",
    "@react-native-firebase/dynamic-links": "^7.0.1",
    "@react-native-firebase/messaging": "^7.0.1",

Please reproduce with current stable, and making sure you have firebase-android-sdk 25.13.0 as an override per https://rnfirebase.io/#android and let us know if this still happens

mikehardy avatar Oct 28 '20 15:10 mikehardy

Hi @mikehardy i did that but still facing same issue ,

Screenshot 2020-10-28 at 8 51 21 PM

Waleed-Nasir avatar Oct 28 '20 16:10 Waleed-Nasir

🤔 Those appear to be the same. And there's no verification of firebase-android-sdk version

mikehardy avatar Oct 28 '20 16:10 mikehardy

I recently faced this issue without any particular change in the dependencies I was using. I just upgraded all my packages (app, messaging & analytics) to latest version, made a clean build & facing the same problem. I have no clue on what I should do to debug what appear to be an incorrect firebase initialisation. I will try to rollback as explained in this link because I really don't know what to do. Any help appreciated...

MoOx avatar Oct 29 '20 09:10 MoOx

Ok, using adb logcat you can quickly find an more explicit error API key expired. Please renew the API key. from firebase.

2020-10-29 11:35:18.368 4585-4669/*redacted* W/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.",
        "status": "INVALID_ARGUMENT",
        "details": [
          {
            "@type": "type.googleapis.com/google.rpc.Help",
            "links": [
              {
                "description": "Google developer console API key",
                "url": "https://console.developers.google.com/project/*redacted*/apiui/credential"
              }
            ]
          }
        ]
      }
    }
    ]

MoOx avatar Oct 29 '20 10:10 MoOx

@MoOx you must have crossed the version barrier that included this change as they migrate internally from instance id to installations: https://firebase.google.com/support/release-notes/android#iid_v20-1-7

I can add a note the firebase app release notes indicating you may need to re-download your project firebase config files (android json / ios plist) as I believe that is the resolution?

mikehardy avatar Oct 29 '20 13:10 mikehardy

https://github.com/invertase/react-native-firebase/commit/ee9edffdd506608554db7233d565b71d4148cf97

mikehardy avatar Oct 29 '20 13:10 mikehardy

Interesting. In my precise case, my bundle id has been changed (from the one when the API Key has been generated) a few month ago but the error only popped since a few days.

MoOx avatar Oct 29 '20 13:10 MoOx

I guess that's enough indeed.

MoOx avatar Oct 29 '20 13:10 MoOx

the last update to @react-native-firebase/app ratcheted the underlying firebase-android-sdk version up, and that one I believe included more of the dependency switching internally upstream from instance id to messaging, which likely triggered it even though it's been in process a while. Thanks for checking the change to see if was good, hopefully this helps others help themselves so they don't get stuck. Subtle issue!

mikehardy avatar Oct 29 '20 14:10 mikehardy

@Waleed-Nasir I'm going to mark this is closed but I recognize that is a bit of an assumption, we can reopen if grabbing fresh copies of your project configs from firebase console doesn't resolve it as that would mean we have mis-diagnosed your problem and there is something else going on. Cheers

mikehardy avatar Oct 29 '20 14:10 mikehardy

same issue. I am using adb logcat ı take this error

Error when communicating with the Firebase Installations server API. HTTP response: [400 Bad Request: {
  "error": {
    "code": 400,
    "message": "API key not valid. Please pass a valid API key.",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console",
            "url": "https://console.developers.google.com"
          }
        ]
      }
    ]
  }
}
]

grkemtneri avatar Nov 02 '20 07:11 grkemtneri

@grkemtneri you probably just need to download new project config files (google config json and plist) from the firebase web console for your apps, into your apps and rebuild / retry

mikehardy avatar Nov 08 '20 18:11 mikehardy

did u read previous comments?

MoOx avatar Nov 16 '20 10:11 MoOx

Getting this error on Android after upgrading to v6 on messaging().getToken(), while ios works fine. Found this error after running adb logcat.

Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
  "error": {
    "code": 403,
    "message": "Requests from referer \u003cempty\u003e are blocked.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/{id}",
          "service": "firebaseinstallations.googleapis.com"
        }
      }
    ]
  }
}
]

elinahovakimyan avatar Nov 18 '20 13:11 elinahovakimyan

@elinahovakimyan - if you download a new google-services.json this should resolve for you - we discovered post-release that this was a requirement as we moved across one of the underlying firebase-android-sdk versions - now I can't find a link to either changelog or PR (sorry) but I'm pretty sure that will do it

mikehardy avatar Nov 18 '20 14:11 mikehardy

@elinahovakimyan - if you download a new google-services.json this should resolve for you - we discovered post-release that this was a requirement as we moved across one of the underlying firebase-android-sdk versions - now I can't find a link to either changelog or PR (sorry) but I'm pretty sure that will do it

@mikehardy I have tried that but it didn’t help.

elinahovakimyan avatar Nov 19 '20 06:11 elinahovakimyan

Only other thought is that it's API key restrictions that are project-specific somehow, or missing SHA hashes in Android config. It is project-specific though, messaging definitely works, sorry

mikehardy avatar Nov 19 '20 13:11 mikehardy

I solved error by re-checking sha-1 key again in Android config and then put new google-services.json. I don't know why it worked well before upgrading and not working after upgrading though.

jehee-choi avatar Nov 20 '20 10:11 jehee-choi

Getting this error on Android after upgrading to v6 on messaging().getToken(), while ios works fine. Found this error after running adb logcat.

Error when communicating with the Firebase Installations server API. HTTP response: [403 Forbidden: {
  "error": {
    "code": 403,
    "message": "Requests from referer \u003cempty\u003e are blocked.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "API_KEY_HTTP_REFERRER_BLOCKED",
        "domain": "googleapis.com",
        "metadata": {
          "consumer": "projects/{id}",
          "service": "firebaseinstallations.googleapis.com"
        }
      }
    ]
  }
}
]

@elinahovakimyan Have you got the solution? Please let me know as I am facing the same Error i.e. 403.

mohitsharma90 avatar Jan 05 '21 09:01 mohitsharma90