After adding 127.0.0.1 in Firebase Console → Authentication → Settings → Authorized Domains, if your code is still not working or showing the same error (INVALID_APP_CREDENTIAL), try using 127.0.0.1 as the URL instead of localhost.