Sir my flutter App is published but OTP and google sign in not working. I am seeing the Error saying "The 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 package Name or SHA256 paIr is registered in the Firebase Console.]
My flutter App has key.jks and key.properties
I have used this coomand and installed key.jks in my App folder
keytool -genkey -v -keystore c:\Users\hp\key.jks -storetype JKS -keyalg RSA -keysize 2048 -validity 10000 -alias key
Also used this command " keytool -list -v \ -alias androiddebugkey -keystore C:\Users\hp\.android\debug.keystore "
to get SHA1 and SHA 256.
Registered the above SHA1 and SHA256 in the Firebase Console also .
In Firebase Authentication I have selected Phone provider and Google Sign In provider also .
Note : But my App is working fine when I am running my code and installing in my device or phone before publishing the App in the playstore. I mean to say the same code is working fine and OTP and google sign in are also working fine before publishing.
CodePudding user response:
" keytool -list -v \ -alias androiddebugkey -keystore C:\Users\hp.android\debug.keystore
This command is for only debug
When you publish your app you need to add release SHA-1 and SHA-256
Try this
keytool -list -v -keystore {keystore_name} -alias {alias_name}
CodePudding user response:
When you updated Android Studio, the debug key which is used to sign debug apps might have changed. Just add the new SHA-1 checksum of your debug key in the firebase console.
Easiest way would be to connect/sync to firebase from
Tools>Firebase>Authentication>Connect>Sync
If you want to do it manually or for release keystore, first generate SHA-1 checksum using following command:
keytool -list -v -keystore KEYSTORE_PATH -alias ALIAS_NAME
Then copy the SHA-1 checksum and go to:
Firebase Console > Your project > Settings of the app > Add Fingerprint
For more info, read this guide: Authenticating Your Client | Google APIs for Android