2017-11-27 3 views
0

firebase.auth()を使用して認証を作成し、firebaseのマニュアルsignInWithUsernameAndPasswordから直接メソッドを呼び出そうとすると、動作しません。私は ウェブストームを使用しており、認識できない方法だと言われています。Firebase web。いいえsignInWithUsernameAndPassword関数

// 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); 

}); 

これは私のjavascriptファイルです。推奨される関数はsignInViaPopup()とsignInViaRedirect()のみです。なぜそれがまさにドキュメンテーションが使用すると言っているときsignInWithUsernameAndPassword関数はありませんか?

+0

また、 'firebase console - > authentication - > sign-in method 'でEmail/Passwordオプションを有効にする必要があります。 – Hareesh

答えて

0

signInWithUsernameAndPasswordは存在しません。 Firebase Authはユーザ名とパスワードを使用したサインインをサポートしていません。電子メールとパスワードを使用したサインインだけがサポートされています。同等の方法はsignInWithEmailAndPasswordです。 Firebaseのドキュメントやリファレンスには、まったく言及していないはずです。

関連する問題