Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Authentication results in Error Code "auth/network-request-failed"

I'm developing a react-native app which uses Firebase for authentication.

When ever I'm starting the authenticate request it results in the following error:

N {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."}

Here is the code I use to authenticate/create user. Note: I'm using redux to maintain state.

firebase.auth().signInWithEmailAndPassword(email, password)
        .then(user => authenticateUserSuccess(dispatch, user))
        .catch((error) => {
            console.log(error);
            firebase.auth().createUserWithEmailAndPassword(email, password)
                .then(user => authenticateUserSuccess(dispatch, user))
                .catch(() => authenticateUserFail(dispatch));
        });

Following are the dependencies I'm using in the project:

"dependencies": {
    "axios": "^0.15.3",
    "firebase": "^3.7.2",
    "lodash": "^4.17.4",
    "react": "15.4.2",
    "react-native": "0.42.0",
    "react-native-router-flux": "^3.38.0",
    "react-native-vector-icons": "^4.0.0",
    "react-redux": "^5.0.3",
    "redux": "^3.6.0",
    "redux-thunk": "^2.2.0"
}
like image 393
illuminate Avatar asked Apr 16 '17 17:04

illuminate


1 Answers

I had the same problem, everything worked fine, I use React Native Debugger. I didn't remember that for some tests I enabled the "Enable Network Inspect" option. From there I started getting the error, the solution, just was disable the option. The post was a long time ago, but the last day happened to me, and maybe it's good for someone today.

like image 134
Byron Andrés Hernández Aguilar Avatar answered Nov 05 '22 19:11

Byron Andrés Hernández Aguilar