大佬教程收集整理的这篇文章主要介绍了React + Firebase 身份验证:在不更改当前登录用户的情况下创建新用户,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我的 ReactJs 应用中有一个管理区域,我需要允许管理员在不更改当前登录用户的情况下@R_568_10589@。
这个问题已经有人问过了,这里有答案:
Firebase Auth state changes after creaTing new user
但是上面不是为ReactJs量身定做的,我也不太明白。我也没有使用 Firestore 数据库,所以我不确定上面的答案是否适合我。
这是我用于正常注册的当前功能:
import firebase from "../../firebase"; //a file where we have firebase initialization with the SDK
// Signing up with Firebase
export const signup = (email,password) => async dispatch => {
try {
dispatch(beginAPICall());
firebase
.auth()
.createuserWithEmailAndpassword(email,password)
.then(dataBeforeEmail => {
console.log('checking for state')
firebase.auth().onAuthStateChanged(function(user) {
console.log('sending email verification')
user.sendEmailVerification().then(function(){
console.log("email successfully sent");
});
});
})
.then(dataAfterEmail => {
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
// Sign up successful
dispatch({
type: SIGNUP_succesS,payload:
"Your account was successfully created! Now you need to verify your e-mail address,please go check your inBox."
});
} else {
// Signup Failed
dispatch({
type: SIGNUP_ERROR,payload:
"Something went wrong,we Couldn't create your account. Please try again."
});
}
});
})
.catch(() => {
dispatch(APICallError());
dispatch({
type: SIGNUP_ERROR,payload:
"Something went wrong,we Couldn't create your account. Please try again."
});
});
} catch (err) {
dispatch(APICallError());
dispatch({
type: SIGNUP_ERROR,payload:
"Something went wrong,we Couldn't create your account. Please try again."
});
}
};
我不知道如何将上述功能“转换”为无需登录即可@R_568_10589@的功能(我知道我不会使用 .createuserWithEmailAndpassword()
,但这是我所能做的).
非常感谢任何帮助。
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的React + Firebase 身份验证:在不更改当前登录用户的情况下创建新用户全部内容,希望文章能够帮你解决React + Firebase 身份验证:在不更改当前登录用户的情况下创建新用户所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。