Skip to content

default.auth() is not a function #17

@amc8mf

Description

@amc8mf

Hey there Michael,

Thanks a lot for writing this, it helped me a lot today. Wanted to bring something to your attention - I got the following error at the end: TypeError: config_js__WEBPACK_IMPORTED_MODULE_2_.default.auth is not a function

After some googling I found this article: https://stackoverflow.com/questions/48551602/firebase-initializing-without-auth-firebase-auth-is-not-a-function

With this, I had to change my config.js a bit and then got it to work:

`import firebase from "firebase";
import "firebase/auth";
var firebaseConfig = {
...
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);

export const firebaseAuth = firebase.auth;`

Then in other files like Auth, I do this:
import { firebaseAuth } from '../config' firebaseAuth().onAuthStateChanged((user) => {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions