7

unknown status code: 17028 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.

hello there, i m facing this issues while developing application, i have tried to fix and these are the steps i have done so far but the same result:

  • correctly configured the firebase and my flutter application by using the steps on firebase
  • i have signed my app and added the signing key both debug and release keys, both SHA-1 key and SHA-256 key
  • I have enabled Android Verification in google cloud page also
  • i have enabled the authentication provider, phone authentication enabled, password/email enabled

in addition to that when i use testing phone number i added to the console and the otp code i insert, my app works perfectly but when trying to authenticate the phone using other un registered phone numbers it keeps showing me error.

i have cheched flutter doctor -v it has no error also execute flutter commands there is nothing error related thing on the result. I have used the following firebase plugins

firebase_auth: ^0.18.4+1 firebase_core: ^0.5.3 cloud_firestore: ^0.14.4 firebase_admob: firebase_messaging: ^7.0.3 firebase_storage: ^5.2.0

any help from you would be appreciated

Steve Vinoski
  • 19,847
  • 3
  • 31
  • 46
Nathenael Tarek
  • 137
  • 1
  • 6

7 Answers7

6

The solution to this is: If you did your configuration of firebase and app project correctly then

  • Run flutter clean to clean your project dependencies.
  • Download new google-services.json file from firebase and add it to app folder in flutter project.
  • Run flutter pub get to get all dependencies again.
  • Run your project.

Then you're good to go. It worked for me.

Community
  • 1
  • 1
Hydra
  • 184
  • 5
  • All these steps tried. – MUHAMMAD SHAHID RAFI C P Dec 12 '21 at 17:23
  • So, it worked or not? – Hydra Dec 14 '21 at 05:37
  • 1
    Still i am facing the same issue, still investigating – MUHAMMAD SHAHID RAFI C P Dec 14 '21 at 14:20
  • 1
    The solution to this is: Press 'Win + R' and run "resmon.exe". Go to CPU tab and search for "build" in Associated Handles search bar. Right click on "java.exe" process and click on END PROCESS. Run flutter clean to clean your project dependencies. Download new google-services.json file from firebase and add it to app folder in flutter project. Run pub get to get all dependencies again. Run your project. Then you're good to go. It worked for me. – Hydra Dec 15 '21 at 14:28
  • 1
    I am using ubuntu, can you detail about what to do on ubuntu ? – MUHAMMAD SHAHID RAFI C P Dec 15 '21 at 19:21
  • bro haven't worked on ubuntu on flutter yet. what you can do is google how to kill java.exe process in ubuntu and I think you would be good to go. rest of the steps might be the same. For your reference I am attaching the link: https://www.google.com/search?q=how+to+kill+java+exe+process+in+ubuntu&oq=how+to+kill+java.exe+process+in+ub&aqs=chrome.1.69i57j33i22i29i30.16634j0j7&sourceid=chrome&ie=UTF-8 – Hydra Dec 18 '21 at 13:41
  • 1
    just needed to rebuild the project , thanks a lot – Gaurav Mar 17 '22 at 15:51
4

If all above solution tried, follow my solution. I believe your problem may be same as mine.

please check your android/app/build.gradle file.

signingConfigs {
        if (System.getenv("ANDROID_KEYSTORE_PATH")) {
            release {
                storeFile file(System.getenv("ANDROID_KEYSTORE_PATH"))
                keyAlias System.getenv("ANDROID_KEYSTORE_ALIAS")
                keyPassword System.getenv("ANDROID_KEYSTORE_PRIVATE_KEY_PASSWORD")
                storePassword System.getenv("ANDROID_KEYSTORE_PASSWORD")
            }
        } else {
            release {
                keyAlias keystoreProperties['keyAlias']
                keyPassword keystoreProperties['keyPassword']
                storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
                storePassword keystoreProperties['storePassword']
            }
        }
    }

In my verygood cli created project signingConfigs is configured for only release build, so my own generated key is not using for build debug apk. So

From root directory of flutter project

cd android/
./gradlew signingReport

Collect your default SHA-1 and SHA-256 key and updated on firebase console.

flutter clean and run project

Don't need to update google-service.json file

MUHAMMAD SHAHID RAFI C P
  • 1,067
  • 1
  • 12
  • 25
  • 1
    This part solved it: From root directory of flutter project cd android/ ./gradlew signingReport Collect your default SHA-1 and SHA-256 key and updated on firebase console. – tsig Dec 23 '21 at 12:16
2

Im my case i found out that google has put my app i guess in blacklist, cos i have tried the same code with different app key, it worked as a charm, but that key has been blacklisted that it doesn't work still.

thanks for your answers, surely appreciate it

Nathenael Tarek
  • 137
  • 1
  • 6
1

I have encountered similar problem. My solution was: Regenerate my-upload-key.keystore. I hope it will be useful!

BymDeMon
  • 11
  • 4
1

You have to enable app verification.

You can check this answer https://stackoverflow.com/a/53513327/14709655

and you can use this link https://firebase.google.com/docs/auth/android/phone-auth#enable-app-verification

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Oct 30 '21 at 02:54
1

In my case my SHA-1 and SHA-256 keys that are added in firebase were different with play store app integrity certificates.

So I added both in firebase project setting one from local machine and another from play console app integrity as shown in picture below:

enter image description here

Shiva Yadav
  • 72
  • 1
  • 9
0

I face a similar problem. So Please Add SHA-256 Key On Firebase Not SHA-1

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 09 '22 at 01:22