flutterdartfirebase-authenticationgoogle-developers-console

Android Device Verification not working in Flutter


I am trying to do get OTP without Verifying you are not a robot screen using firebase in a flutter.

I added the SHA-256 key in firebase and enabled the Android Device Verification in console developer google. But still after entering the phone number for OTP that Verifying you are not a robot screen was showing and redirecting to the app. Did I miss something or it will take time to activate Android Device Verification.


Solution

  • You need to add your machine's SHA1 SHA256 to firebase project, which you can get from this command:

    Mac keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

    Windows keytool -list -v -keystore "\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android

    Linux keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android

    Once you got the keys, go to Firebase Console > Project Settings > Scroll down and in your android app > add the both sha1 sha256 keys via add fingerprint button.

    If recaptcha is still showing, then make sure the following things:

    Try to test it on a real device. If you are testing phone authentication on an emulator then reCAPTCHA screen will be still shown but for real devices it won’t be shown anymore as stated in the official documentation.

    Addition: It will always be shown in rooted devices.

    Edit: If this is happening only to your playstore downloaded application, then you probably didn't add your playstore signing SHA1 and SHA256 to your firebase.

    enter image description here

    Go to your playstore account, app signing under integrity and copy these keys and add them to your firebase project.