Firebase 身份验证导致错误代码 "auth/network-request-failed"
Firebase Authentication results in Error Code "auth/network-request-failed"
我正在开发一个使用 Firebase 进行身份验证的 react-native 应用程序。
每当我启动身份验证请求时,它都会导致以下错误:
N {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."}
这是我用于 authenticate/create 用户的代码。注意:我正在使用 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));
});
以下是我在项目中使用的依赖项:
"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"
}
检查你的 phone/device。确保 google 服务是 运行。只需打开 playstore 即可查看。如果不是 运行,请重新启动您的设备并再次检查。如果它是 运行 则再次执行您的登录 in/create 用户 firebase。我用这种方式解决了我的问题
我遇到了同样的问题,一切正常,我使用的是 React Native Debugger。我不记得在某些测试中我启用了“Enable Network Inspect”选项。从那里我开始收到错误,解决方案就是禁用该选项。 post 是很久以前的事了,但最后一天发生在我身上,也许今天对某人有好处。
我正在开发一个使用 Firebase 进行身份验证的 react-native 应用程序。
每当我启动身份验证请求时,它都会导致以下错误:
N {code: "auth/network-request-failed", message: "A network error (such as timeout, interrupted connection or unreachable host) has occurred."}
这是我用于 authenticate/create 用户的代码。注意:我正在使用 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));
});
以下是我在项目中使用的依赖项:
"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"
}
检查你的 phone/device。确保 google 服务是 运行。只需打开 playstore 即可查看。如果不是 运行,请重新启动您的设备并再次检查。如果它是 运行 则再次执行您的登录 in/create 用户 firebase。我用这种方式解决了我的问题
我遇到了同样的问题,一切正常,我使用的是 React Native Debugger。我不记得在某些测试中我启用了“Enable Network Inspect”选项。从那里我开始收到错误,解决方案就是禁用该选项。 post 是很久以前的事了,但最后一天发生在我身上,也许今天对某人有好处。