1
0

More than 1 year has passed since last update.

JavaScriptでFirebase9のサインアウト処理

Posted at

JavaScriptでFirebase9のサインアウト処理をコーディングします。
Firebase8とは微妙に異なるので、注意が必要です。

コメントアウトしている部分は、Firebase8のコードです。

//import firebase from 'firebase';
import {getAuth, signOut} from 'firebase/auth'; //firebase9

//const auth = firebase.auth();
const auth = getAuth(); //firebase9

//auth.signOut(); //ログアウト
signOut(auth).then(() => {
  console.log('Sign-out successful.');
}).catch((error) => {
  console.log('Sign-out execing.');
});

参考書籍

この記事は以下の情報を参考にして執筆しました。
・React.js&Next.js超入門 第2版 著:掌田津耶乃

参考サイト

Firebase Googleログイン
https://firebase.google.com/docs/auth/web/google-signin?hl=ja#web-version-9_10

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