firebase

TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_0__.default.auth is not a function

Developer Mobssie 2022. 3. 30. 21:06

[에러 메세지]

TypeError: firebase_compat_app__WEBPACK_IMPORTED_MODULE_0__.default.auth is not a function

 

Modularv9 와 Compat라이브러리 유형 사이에 구문을 혼합해서 사용한 문제

 

 

 

 

[인증 상태 관찰자 설정 및 사용자 데이터 가져오기]

import { getAuth, onAuthStateChanged } from "firebase/auth";

const auth = getAuth();
onAuthStateChanged(auth, (user) => {
  if (user) {
    // User is signed in, see docs for a list of available properties
    // https://firebase.google.com/docs/reference/js/firebase.User
    const uid = user.uid;
    // ...
  } else {
    // User is signed out
    // ...
  }
});

 

 

 

 

 

doc

https://firebase.google.com/docs/auth/web/start

'firebase' 카테고리의 다른 글

[ETC] AWS EC2_콘솔에 로그인하기  (0) 2024.02.08