我正在开发一个使用Firebase进行身份验证的本机应用程序.
当我启动身份验证请求时,会导致以下错误:
N {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."}
Run Code Online (Sandbox Code Playgroud)
这是我用来验证/创建用户的代码.注意:我正在使用redux来维护状态.
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));
});
Run Code Online (Sandbox Code Playgroud)
以下是我在项目中使用的依赖项:
"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"
}
Run Code Online (Sandbox Code Playgroud) authentication firebase react-native firebase-authentication react-redux