Firebase Authentication で認証

【 追記 】2019.02.05

参考記事に誤記があったので、自分のソースを書いておく


.vueファイルに以下を記述


signIn: function () {

        if (this.isNickname && this.isPassword) {

            firebase.auth().signInWithEmailAndPassword(this.nickname, this.password)

                .then(result => {

                    alert('Success! Username: ' + result.user.uid);

                })

                .catch(error => {

                    alert(error.message)

                });

        }

}


signUp: function () {

        if (this.isNickname && this.isPassword) {

            firebase.auth().createUserWithEmailAndPassword(this.nickname, this.password)

                .then(result => {

                    alert('Create account: ' + result.user.uid);

                })

                .catch(error => {

                    alert(error.message)

                })

        }

}



( 参考記事 ) ※一部誤記あり

( 参考記事 ) ※以下は誤記なし