unknown status code: 17028 A safety_net_token was passed, but no matching SHA-256 was registered

2,000

Solution 1

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.

Solution 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

Solution 3

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

Share:
2,000
Nathenael Tarek
Author by

Nathenael Tarek

Senior IOS Developer and Android developer

Updated on December 28, 2022

Comments

  • Nathenael Tarek
    Nathenael Tarek over 1 year

    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

  • Admin
    Admin over 2 years
    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.
  • MUHAMMAD SHAHID RAFI C P
    MUHAMMAD SHAHID RAFI C P over 2 years
    All these steps tried.
  • Hydra
    Hydra over 2 years
    So, it worked or not?
  • MUHAMMAD SHAHID RAFI C P
    MUHAMMAD SHAHID RAFI C P over 2 years
    Still i am facing the same issue, still investigating
  • Hydra
    Hydra over 2 years
    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.
  • MUHAMMAD SHAHID RAFI C P
    MUHAMMAD SHAHID RAFI C P over 2 years
    I am using ubuntu, can you detail about what to do on ubuntu ?
  • Hydra
    Hydra over 2 years
    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: google.com/…
  • tsig
    tsig over 2 years
    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.
  • Admin
    Admin over 2 years
    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.
  • Gaurav
    Gaurav over 2 years
    just needed to rebuild the project , thanks a lot