How do i generate a signed APK that uses Firebase Auth? - android

I've built the App on android studio. When I connect my phone to my PC and build it directly through Android Studio it works. I get the phone verification code and am able to sign in. But when I generate a signed APK to distribute it to others, it always says "Verification Failed" and doesn't let me sign in.
I'm pretty sure there's no problem with the code, because it works perfectly when I build it through Android Studio directly onto my phone.
What Ive Tried:-
I followed the steps in this link and changed the SHA-1 code in my firebase console to the one provided in my Google Console, it still says verification failed.
I also tried to keep only one SHA-1 key in my firebase console which is the one i found in my android project, updated the google-services.json file and tried generating a signed APK, its still says verification failed.

Generate a new SHA1 fingerprint from the console in Android Studio using
keytool -list -v -keystore <absolute path of Keys generated during signed APK generation> -alias <app alias name>
Paste the generated fingerprint in the firebase console and delete the older one.
Hope this works!

Related

React Native (Android) Google Sign In Error (Developer Error)

Tried all available solutions on the internet but still getting same error, also cross Checked SHA1 key. Used both methods Firebase and Google Developer console but all in vain.
I have face this issue,
For me I am using react-native-google-signin with firebase.
My problem was SHA certificate fingerprints on firebase console is different with my project keystore.
U can check it by run this command to make sure your SHA on firebase and keystore is same.
keytool -list -v -keystore ~/.android/debug.keystore
This is often caused by no/invalid App Signature. You most likely use bare workflow, since you're getting this error, because expo does this for you when you build the app. To achieve the same in bare workflow
Drop your android folder in Android Studio
In Upper toolbar click Build >> Generate Signed APK
Choose APK from given options.
Type in your KeyStore informations.
After building an app, you must be able to use google sign in.

App not authorized to use Firebase Authentication but working fine with test phone

I'm facing very strange behavior of Firebase. Everything is working fine when I first time upload my apk in play store. After few days when I update my apk. Now it show This app is not authorized to use Firebase Authentication. check the screen shot. I read my answers on StackOverFlow. Almost all of them point that there is some problem in package name or in SHA-1 But in my case everything is perfect when I install app using android studio it's working fine but when I upload it on play store after this it does not work. And the strange thing is that when I enter any test phone it's working but not with the original phone number. I'm using real device. If there is any problem in package name or in SHA-1 then why it's working for test phone numbers ?
UPDATE
I tried almost all the methods but no one is working for me.
I create sha-1 using this.
keytool -list -v -keystore "key store path" -alias "key alias"
output is something like 96:A2:-------------------- I add this into firebase and generate new google_services.json file and place it into android project and upload apk to play store but when I try to run app it show me same error(app not authorized).
After this I try to create SHA-1 from android studio. using
Gradle -> appName -> android -> signingReport
It show something like B0:F7:----------------------------- I add it into firebase console and generate google_servics.json file after uploading apk is not working.
After this I try
tools -> firebase -> auth -> connect -> sync
This one is also not working.
And after this I try to add both SHA-1 in firebase console still not working.
Can you please let me know what can be problem ?
First copy your google-services.json file again to your project. Then you must be having your keystore for your release apk.
So in order to obtain the SHA1 of your release app.
Go to your /bin in JDK directory.
And run the following command in your cmd.
keytool -list -v -keystore "key store path" -alias "key alias"
This command will give you all the required details of your release version. Copy the SHA1 string and add it to your firebase console.
You are good to go.

Firebase phone authenticatication error on production

I am working on an app that uses firebase phone authentication (authUI) to sign in users. I have integrated firebase successfully in multiple apps before without any error. For this app I get the error on. This is very annoying since the app does not produce the same error on debug. I noticed the error when I uploaded the apk to playstore and my users started complaining. I have double checked everything. I even used the firebase plugin to import firebase to the project. Everything on google-services.json is okay even SHA1 matches. Anybody experienced the same and maybe anyone who know how to solve it?? Frustrating
You need to add Release Keystore SHA1 to your Firebase project just as you did add Debug SHA1
You can obtain the key
keytool -list -v -keystore [release_key_path_here]
Copy the certificate fingerprint SHA1
Follow detail steps here

Android [App Validation Failed] phone authentication error on Firebase

I have attached firebase on my existing android project and ran it. Here is the scenario:
If the app ran from android studio via developer mode, it(Firebase sign in via phone number) runs smoothly and I manage to log in.
However, whenever I build signed debug apk, Firebase does not allow to sign in. It gives the following message:
This app is not authorized to use Firebase authentication. Please
verify the correct package name and SHA-1 are configured in the
firebase console (App Validation Failed).
I have SHA-1 and SHA-256 key installed on Firebase console generated from my windows machine.
I would have normally provided the code however, I am guessing there is nothing wrong with the code. It works fine with the debug process. I have changed to the up-to-date google-services file from console.
Any help would be highly appreciated. Thanks in advance.
Here is my error:
When debugging, I used the normal debug key from .android/debug.keystore and this key is stored in the Firebase SHA1 field.So it worked perfectly. While trying to create a signed version, I generated a separate keystore file and created signed apk using that. Now, since the SHA1 key varied from the debug, the app was not recognized on the firebase console.
I changed the signed key to debug key. I did not want to go through a lot of changes.
If you are using another key to sign your production apk, you can obtain SHA-1 fingerprint like this:
keytool -exportcert -list -v \
-alias <your-key-name> -keystore <path-to-production-keystore>
Then you will obtain something like this:
Certificate fingerprint: SHA1: DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09
After that just copy SHA1 fingerprint and paste in your firebase's project adding new digital print in following menu:
Project Overview => Pulse in the cog (settings) => Project Configuration => scroll to bottom => add digital fingerprint.

Google Sign In not working when built in my Android Studio

A third-party has developed the main structure for my app, including a Google Sign In. When they test it, it works. When I run the APK that they built, it works. When I build using the project files, it fails with a handleSignInResult:false error.
I've reinstalled Android Studio, installed all the possible SDKs, but to no avail. Does anybody have any idea why one project will build successfully on one computer, but not on mine?
Could it be something to do with the SHA-1?
Yes...You guessed it right.Its about SHA-1 Key.
You need to add you SHA-1 key generated from your PC keystore
How to get SHA-1 from Android Studio ?
Than add that key in your Firebase console or in Google Console
How to add SHA-1 key to console ?
First thing we need SHA-1 key for integrate google sign in we need to register this key in google developer or google api console,
As per my or other experiance SHA-1 key will change when you change your systm so you need to replace your SHA-1 key with latest from your systme.
You need to Generate Your SHA-1 Release Key for Gmail Login After Build Apk
Follow step
1.Open CMD terminal
Goto Java folder using
1. cd java
2. cd jdk1.8.0_112
3. cd bin
C:\Program Files\Java\jdk1.8.0_112\bin>
Enter Following Command:
keytool -list -v -keystore "PATH OF .jks Keystore" -alias android
Note: android is my Keystore Alias
then you will get this : Enter keystore password(Enter your keystore password)
Just update your sha-1 to firebase and goo to tools->Firebase->Authentication->click Connect to firebase.It worked for me;)
Get your sha from Gradle->app->task->android->click Signing report
copy the sha1 past to firebase project settings bottom.

Categories

Resources