2

I am using flutter and firebase OTP. The SMS is received while running the debug APK of my app. However, I am getting this message while running the release APK using the command flutter run --release.

This is the returned message:

This app is not authorized to use Firebase Authentication. Please verify that the correct package name and SHA-1 are configured in the Firebase Console. [ A safety_net_token was passed, but no matching SHA-256 was registered in the Firebase console. Please make sure that this application’s packageName/SHA256 pair is registered in the Firebase Console. ]

Kindly note that I am running this app directly on my phone and not by installing it from google play.

I tried the following on firebase console:

  1. Debug keys
  2. Release Keys
  3. Google Play signing and upload keys certificates.
  4. Also my google-services.json is up-to-date.
  5. Flutter clean and pub get before running in order to make sure that the changes will occur.

I tried all the solutions presented by similar questions such as adding an email in firebase, adding google play keys, etc. and unfortunately none of them worked.

Update: Solved, the problem was wrong naming inside the manifest file as the error message stated:
Please make sure that this application’s "packageName/SHA256" pair is registered in the Firebase Console. Usually, it is the sha1 or sha256 keys, however this time it was the package name.

Majd Harb
  • 55
  • 2
  • 8

3 Answers3

2

You have to generate SHA-1 for relase build and add it to the firebase console for the same project that you have registered.

Hardik Mehta
  • 2,195
  • 1
  • 11
  • 14
2
  1. do flutter clean and flutter pub get then.
  2. use flutter fire cli to link the firebase project
  3. Generate a signin report by doing cd android and .\gradlew signingReport
  4. look for gradient release and upload that vairent sha1 and sha256 key. hope this sloves your problem.
  • Thank you! Also here is a guide for app signing: https://developer.android.com/studio/publish/app-signing#:~:text=Generate%20an%20upload%20key%20and%20keystore,-If%20you%20don&text=In%20the%20menu%20bar%2C%20click,store%20path%2C%20click%20Create%20new. – Majd Harb Oct 31 '22 at 12:02
1

You need to add SHA Keys in firebase console, to get SHA KEY

  • Open Android Studio
  • Open Project
  • Reveal android folder
  • Right click "gradlew" file and select Open in Terminal
  • Go to the terminal view and paste: gradlew signingReport

You will find the SHA-1 fingerprint in the "Gradle Console"

Add this SHA-1 fingerprint in firebase console and test again

Mobin Ansar
  • 631
  • 2
  • 13