Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 238
Nathenael Tarek Avatar asked Oct 15 '22 21:10

Nathenael Tarek


2 Answers

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.

like image 140
Hydra Avatar answered Nov 02 '22 05:11

Hydra


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

like image 31
MUHAMMAD SHAHID RAFI C P Avatar answered Nov 02 '22 07:11

MUHAMMAD SHAHID RAFI C P