Reputation: 194
I am trying to build a login using the firebase email/password auth. I have set up my project and keys and everything works on the android side. I am trying to build the web side of it and can't seem to get the login to work.
Here is my javascript:
(function(){
// Initialize Firebase
const config = {
apiKey: "MY_API_KEY",
authDomain: "MY_AUTH_DOMAIN",
databaseURL: "MY_DATABASE_URL",
storageBucket: "MY_STORAGE_BUCKET",
};
firebase.initializeApp(config);
// Get elements
const loginEmail = document.getElementById('loginEmail');
const loginPassword = document.getElementById('loginPassword');
const loginButton = document.getElementById("loginButton");
// Add login event
loginButton.addEventListener('click', function() {
// Get email and password
const email = loginEmail.value;
const pass = loginPassword.value;
var auth = firebase.auth();
// Sign in
auth.signInWithEmailAndPassword(email, pass).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
console.log("Error code: " + errorCode);
console.log("Error message: " + errorMessage);
});
});
}());
Here are the errors I keep getting:
Error code: auth/internal-error
Error message: {"error":{"errors":[{"domain":"usageLimits","reason":"keyExpired","message":"Bad Request"}],"code":400,"message":"Bad Request"}}
Upvotes: 3
Views: 1642
Reputation: 1735
I experienced same error and it is because I generated a new key from console.developers.google.com and still using the old Auto Generated API Keys (which was deleted). Got this resolved, when I re downloaded a new config file or replacing the old api key to the newly created/auto created key.
Upvotes: 2