5

I have the following issue while retrieving firebase Token with

FirebaseMessaging.getInstance().getToken()

in DEBUG mode I get the token and I send it to the server

in RUN mode, the app works fine, it's published BUT I can't get the token since I've got thanks to Crashlytics @Firebase console

java.io.IOException: FIS_AUTH_ERROR

I tried all suggested solutions found here java.io.IOException: FIS_AUTH_ERROR in Android Firebase without success

Library used, build.gradle (:app)

implementation platform('com.google.firebase:firebase-bom:26.7.0')
C.B.
  • 378
  • 6
  • 19
  • Did you managed to fix this in any way? Without any major changes, one flavour's run and build outputs ended with this issue too. – Underscore May 06 '21 at 19:02
  • I can't get rid of it & I can't find another solution. I added an in-app testing user feature to retrieve the firebase token. So far, with 2 releases per week and many evolutions of libraries, Android Studio, gradle, still ok in debug mode, still ko in release mode – C.B. May 07 '21 at 14:54

1 Answers1

2

I realized that I didn't add my dev certificates to the APIs that that flavour was using. Let me just copy+paste the answer I gave in another thread:

If you have your APIs keys restricted (which you should), make sure you add your dev certificate and bundle ID to the key/s.

Visit your dashboard, select the project from top bar -> API keys and there you should see them (auto created by Firebase).

Hope this solves your problem!

EDIT: More details about this issue (see comments).

You should only need 1 SHA/instance and for release only for the signing certificate. I will advice you to use flavours for each different part of dev/testing/release. Each dev should provide the local debug certificate and these can be used to sign in app distributed via Firebase, for example. Separate, a set of production APIs which will be best to restrict on the release certificate ONLY.

Just remember that every new PC used for developing will require to provide the SHA to be added in the restrictions. It will be a ride to forget about this part! :)

Good luck!

Underscore
  • 952
  • 8
  • 12
  • Great suggestion, but so far it did not solve my problem. I checked the **Android key (auto created by Firebase)** restricted but with my package name and SHA-1 signing-certificate well-mentionned. I wonder if the key auto created by Firebase should not figure in the source of the android project or in the generated google-services.json, because I can't find it anywhere but in the dashboard [link](https://console.cloud.google.com/apis/credentials) – C.B. May 11 '21 at 08:59
  • When you release your app, I don't think you can use a dev certificate, but you can let Google manage those. Check your app's Play Console dashboard -> Release tab (left side) -> Setup -> App integrity. There you'll have your App signing certificate and your upload key certificate. – Underscore May 11 '21 at 13:08
  • With `implementation platform('com.google.firebase:firebase-bom:28.0.0')` and the 3 (I was aware of only one) SHA-1 dispatched for every restrictions, it now works in release mode. Thanks for your help ! – C.B. May 13 '21 at 16:34
  • Welcome and good luck! I added more explanations to the post for future viewers. – Underscore May 14 '21 at 15:41