Firebase OTP not working after uploading flutter app to Playstore
Asked Answered
I

7

7

I have made a flutter app with firebase with OTP verification, it is working fine in debug mode and releasing APK. But after uploading to playstore the phone doesn't receive an OTP message. I have added the SHA - 1 and SHA - 256 keys from the play console to firebase project settings, still not working. Is there a time delay or something before the change is reflected in the application after updating the app in playstore (Internal testing)?

Ionian answered 19/3, 2021 at 12:26 Comment(3)
did you download and add google services. json in the Application after updating in firebase? Did you add safetynet code?Dinse
what is safetynet code ? can you please explainIonian
Share you logcat screenshot and what's your phone auth version ?Henceforth
H
6

For debug keys : Open your project in android studio > Click on Gradle (In the right panel) > Click on Your Project > Click on Tasks > Click on android > Double Click on signingReport

For release keys : Use this command to generate release keys: keytool -list -v -keystore "your jks file path " -alias "key name"

Add jks path and key name and run this command in android studio terminal.

OR

You can also get SHA1 and SHA- 256 from google play console . Go to Play store Console > Your project > Release > Setup > App signing .

  1. Copy both debug and release SHA1 and SHA- 256 keys and paste in firebase console .
  2. Update your firebase-auth version to 20.0.1 then you also need to configure safetynet in your project. For more info check this link
  3. Make sure PHONE AUTHENTICATION is enabled . Go to Firebase console -> Authentication -> Sign-in Methods.
  4. After adding keys , download updated google-services.json and add in your project.
  5. Clean project and then rebuild project.
  6. Test your app again (In order to prevent abuse the firebase phone authentication wont work in emulator so test on real device).

Check if you have completed all the above steps in your proejct . If your app is live on play store make sure your firebase project have both debug & release SHA1,SHA-256 key in your firebase console.

Henceforth answered 24/3, 2021 at 11:39 Comment(2)
I just updated the SHA1 and 256 and it workedLeeward
Expanding on this solution, if you are working on a release version of the app then go to google play console > setup > app integrity > app signing. there you will find a list of SHA-1 and SHA-256 fingerprints. enter the first ones under "App signing key certificate" into firebase project config. This is what solved it for me.Wooley
A
3

I also came across same problem with phone authentication You can go to Google cloud platform of the firebase app From there go to credentials (You can search credentials) Add a OAuth credential give the sha1 that you get from play console and package name while creating this OAuth credential This worked for me

Alkalify answered 24/3, 2021 at 4:53 Comment(0)
N
2

Several possibilities come to mind. After entering your Sha key, you need to add the new json file to your project. Firebase responds quickly to updates

Another possibility is cloud rules. Check this area. This situation may halt the process.

Nora answered 19/3, 2021 at 12:51 Comment(1)
I had updated the google-service.json file too but still the ##exception## persists. I checked the package name too, that was also correct. What all files should I check for finding the error?Ionian
T
1

It might be because you have uploaded only release signing keys. Add upload keys from Google Play Console and it will work.

Trista answered 26/8, 2021 at 7:21 Comment(0)
F
0

You need to install the Google Play service in Firebase. Follow the following steps:

  1. Go to Firebase console -> Click your project
  2. Click on settings icon which is right of Project Overview -> then Project settings -> Under Integrations -> Click on Link option under Google Play
Frederik answered 19/3, 2021 at 12:50 Comment(4)
The Firebase account and Google account are different. wil that be a problem ?Ionian
No it will not create any problem.Frederik
But its Still its not working. It shows Exception !! 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 ConsoleIonian
Let me clear in detail, the email which you are using for Firebase account must be same with the non - Firebase google service like google maps, google translate and so on. If you just want to publish you app using another google account it is fine.Frederik
D
0

Update SHA-1 Key in Firebase project setting

enter image description here

Also check your google cloud project api key setting and also add SHA-1 Key credentials if you have Key restrictions.

enter image description here

Directed answered 19/8, 2022 at 15:53 Comment(0)
W
0

I am expanding on the solution provided in this answer as it was not sufficient to solve it for my case.

If you are working on a release version of the app then go to Google play console > setup > app integrity > app signing. You will find a list of SHA-1 and SHA-256 fingerprints. Enter the first ones under "App signing key certificate" into Firebase project config.

Wooley answered 30/8, 2022 at 7:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.