LoginSignup
1
0

More than 3 years have passed since last update.

[firebase] consoleからログイン、ログアウト

Last updated at Posted at 2019-07-23

個人サービスでwordpressみたいなcmsを作った際、ログイン機能を自分しか使わなかったためログイン画面を作るのが面倒だった

以下、developer-toolsのconsoleからログイン、ログアウトするためのコード

signin
firebase.auth().signInWithEmailAndPassword("yourEmail", "yourPassword")
  .then(user => {
    console.log("you logged in!");
  }, err => {
    console.log("you failed to log in");
  });
signout
firebase.auth().signOut()
  .then(user => {
    console.log("you logged out!");
  }, err => {
    console.log("you failed to log out");
  });

以上。

追記:安全性に懸念があるとかあればどなたか教えていただきたし。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0