Meine Webanwendung verwendet Firebase und ich verwende E-Mail/Passwort als Anmeldemethode für meine Anwendung.Ist ist mein Formular innerhalb <form></form>
Tag bin ich bekommen auth/Netzwerk-Anfrage-fehlgeschlagen error.Authentication funktioniert gut, wenn ich Form zu Div.
Schritte folgte ich
Schritt 1: Aktiviert Email/Passwort Log-in Verfahren Firebase-Authentifizierung: signInWithEmailAndPassword gibt den Fehlercode auth/network-request-failed zurück
Schritt 2: eine Dummy-Benutzer hinzugefügt
Schritt 3: Hier ist Meine Authentifizierungsfunktion
function authenticateUser() {
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
firebase.auth().signInWithEmailAndPassword(email, password).catch(function (error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
if (errorCode === 'auth/wrong-password') {
alert('Wrong password.');
}
else if (errorCode = 'auth/network-request-failed') {
alert('Network error.');
} else {
alert(errorMessage);
}
console.log(error);
});
}
Schritt 4: Anmeldungsformular
<form class="form-signin">
<h1>Login to Your Account</h1>
<label for="inputEmail" class="sr-only">Email address</label>
<input type="email" id="email" class="form-control" placeholder="Email address" required="" autofocus="">
<label for="inputPassword" class="sr-only">Password</label>
<input type="password" id="password" class="form-control" placeholder="Password" required="">
<div class="checkbox">
<label><input type="checkbox" value="remember-me"> Remember me</label>
</div>
<button id="login" class="btn btn-lg btn-primary btn-block" type="submit">Sign in</button>
</form>
Bevor Sie die Leute zu fragen überprüfte ich die Firebase Documentation und samples on github und natürlich viel gegoogelt.
Bitte helfen Sie mir.
Es tut mir leid, aber was meinen Sie manuell? – shreesha
wie dieses 'signInWithEmailAndPassword ('[email protected] ',' password ')' –
Nein. Es funktioniert nicht – shreesha