简体   繁体   English

Firebase 网站。 没有 signInWithUsernameAndPassword 功能

[英]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.

相关问题 Firebase 消息 web。多标签通知 - Firebase messaging for web. Multiple tabs notifications Firebase网站。 检查数组中的对象是否具有特定值 - Firebase web. Checking if an object in an array has a particular value Firebase-网络。 无法显示登录用户的图片 - Firebase - Web. Can not display logged user's picture FIREBASE phoneAuth (LinkWithPhoneNumber)。 稍后如何在 Firebase Web 中更改用户的关联电话号码。 ( nodejs, Create-react-app )? - FIREBASE phoneAuth ( LinkWithPhoneNumber ) . How to change a user's linked phone number later in Firebase Web. ( nodejs, Create-react-app )? ngOnChanges 未在本机或移动网络中触发。 离子 4 - ngOnChanges not fired in native or in mobile web. Ionic 4 在网络上缓存。 浏览器中的地址初次访问如何处理? - Caching on the Web. How are address initial visits treated in the browser? 网页材料设计。 如何设置 mdc.menu 的位置? - Material design for the web. How to set the position for a mdc.menu? Remove() 函数在 firebase for web 中不起作用 - Remove() function doesnt work in firebase for web TypeError: firebase.firestore() is not a function web javascript - TypeError: firebase.firestore () is not a function web javascript Android Talkback未在网络上注册onFocus。 如何使用Android Talkback操作可访问性焦点? - Android Talkback not registering onFocus for web. How do I manipulate accessibility focus with Android Talkback?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM