flutter firebase phone auth error a safety net token was passed but no matching sha-256 was registered in the firebase console

3,018

The solution to this is:

  1. Press 'Win + R' and run "resmon.exe".
  2. Go to CPU tab and search for "build" in Associated Handles search bar.
  3. Right click on "java.exe" process and click on END PROCESS.
  4. Run flutter clean to clean your project dependencies.
  5. Download new google-services.json file from firebase and add it to app folder in flutter project.
  6. Run pub get to get all dependencies again.
  7. Run your project.

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

Share:
3,018
SILENMUS
Author by

SILENMUS

Updated on December 25, 2022

Comments

  • SILENMUS
    SILENMUS over 1 year

    I register sha-1 release , debug key on firebase and I All did firebase register tutorial

    but I got this message when I call verifyPhoneNumber();

    in the verificationFailed: (AuthException exception) {exception.message};

    This 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 packageName/SHA256 pair is registered in
     the Firebase Console ] 
    
    

    I thought i don't need to register sha256 if I register sha1 but it says like that

    what is this reason , how can i solve this problem??

    • SardorbekR
      SardorbekR over 3 years
      have you found a solution
    • SILENMUS
      SILENMUS over 3 years
      just register project sha-256 on firebase console then all good
  • Janpan
    Janpan over 3 years
    After adding the SHA fingerprints, you have to download the google-services.json file again and add it to your project again (replace the previous one). Also double check that the package name in your google-services.json file corresponds to the package name or project id in your build.gradle. e.g. com.example.etc...
  • MUHAMMAD SHAHID RAFI C P
    MUHAMMAD SHAHID RAFI C P over 2 years
    what about flavor enabled flutter project ? projectid is com.companyname.appname and package name is com.companyname.appname.dev