This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
1
Firebase Project Results in “Auth/network-request-failed” error on login
Post Body
I'm running into a strange problem with my Firebase project when I try to use Password authentication. It works most of the time in Chrome (occasionally will result in this error), but when I run my app on an emulator or phone (Android), (at least) the first login attempt per load always results in an "Auth/network-request-failed" error. Here is my relevant Firebase code:
<script src="https://www.gstatic.com/firebasejs/3.2.1/firebase.js"></script>
. . .
$(document).on('click', '#loginButton', function() {
var email = document.getElementById("loginEmail").value;
var password = document.getElementById("loginPassword").value;
firebase.auth().signInWithEmailAndPassword(email, password).then(function() {
user = firebase.auth().currentUser;
//Load in the user's pets and then switch to the "My Pets" page.
$.getJSON('https://petspot-a43e7.firebaseio.com/users/' user.uid '/pets.json', function(data) {
pets = {};
for (var key in data) {
pets[key] = JSON.parse(data[key]);
}
}).then(function() {
$("#header").removeClass("invisible");
Materialize.toast('Logged in successfully!', 2000, 'bottom');
changePage("page1");
});
//Load the user's username and modify the sidebar accordingly.
$.getJSON('https://petspot-a43e7.firebaseio.com/users/' user.uid '/username.json', function(data) {
$("#sidebarName").html(data);
$("#sidebarEmail").html(user.email);
});
}).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
console.log(errorCode);
var errorMessage = error.message;
if (errorCode == "auth/user-disabled") {
$('#' "user-disabled").openModal();
} else if (errorCode == "auth/user-not-found") {
$('#' "user-not-found").openModal();
} else if (errorCode == "auth/too-many-requests") {
$('#' "too-many-requests").openModal();
} else if (errorCode == "auth/wrong-password") {
$('#' "wrong-password").openModal();
} else {
alert(errorCode);
alert(errorMessage);
}
});
Any help would be greatly appreciated. Thank you all so much!
Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
10,023
Link Karma
7,864
Comment Karma
2,115
Profile updated: 1 day ago
Posts updated: 8 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/Firebase/co...