[英]Firebase web. No signInWithUsernameAndPassword function
I am very confused about firebase web because when I create an auth using firebase.auth() then try to call a method directly from the firebase documentation, signInWithUsernameAndPassword, it does not work.我对 firebase web 感到非常困惑,因为当我使用 firebase.auth() 创建身份验证然后尝试直接从 firebase 文档 signInWithUsernameAndPassword 调用方法时,它不起作用。 I am using webstorm and is says it is an unrecognized method.我正在使用 webstorm,并说这是一种无法识别的方法。
// Initialize Firebase
var config = {
apiKey: "AIzaSyBbmdeersid6XSA4kh_TYsGgVSgVF5BrFs",
authDomain: "eraticators-73723.firebaseapp.com",
databaseURL: "https://eraticators-73723.firebaseio.com",
projectId: "eraticators-73723",
storageBucket: "eraticators-73723.appspot.com",
messagingSenderId: "782651564720"
};
firebase.initializeApp(config);
const txtEmail = document.getElementById("user");
const txtPassword = document.getElementById("password");
const btnLogin = document.getElementById("btnLogin");
btnLogin.addEventListener("click", function() {
const email = txtEmail.value;
const pass = txtPassword.value;
const auth = firebase.auth();
firebase.auth().signInWithUsernameAndPassword(email, pass);
});
that is my javascript file.那是我的 javascript 文件。 The only suggested functions are signInViaPopup() and signInViaRedirect().唯一建议的函数是 signInViaPopup() 和 signInViaRedirect()。 Why is there not signInWithUsernameAndPassword function when that is exactly what the documentation says to use????为什么没有 signInWithUsernameAndPassword 函数,而这正是文档所说的使用????
signInWithUsernameAndPassword
does not exist. signInWithUsernameAndPassword
不存在。 Firebase Auth does not support sign in with username and password. Firebase 身份验证不支持使用用户名和密码登录。 It only supports sign in with email and password.它仅支持使用电子邮件和密码登录。 The equivalent method is signInWithEmailAndPassword
.等效的方法是signInWithEmailAndPassword
。 The Firebase docs and references should not mention the former at all. Firebase 文档和参考资料根本不应提及前者。
can you please check have you enabled authentication with Email/Password.你能检查一下你是否启用了电子邮件/密码身份验证。 if you didn't enable it.如果你没有启用它。 Follow the path given below:-按照下面给出的路径:-
firebase console -> authentication -> sign-in method.
and enable signIn with email/password并使用电子邮件/密码启用登录
您需要在 html 中添加 script auth 标签。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.