N
Nuxt9mo ago
Grincek

TypeError when using firebase

import firebase from 'firebase/app';

export default {

props: {
authApi: {type: Object, required: true}
},
methods: {
googleSignIn: function() {
const provider = new firebase.auth.GoogleAuthProvider();
console.log(firebase);
firebase
.auth()
.signInWithPopup(provider)
.then((result) => {
const token = result.credential.accessToken;
const user = result.user;
console.log(token); // Token
console.log(user); // User that was authenticated
})
.catch((err) => {
console.log(err); // This will give you all the information needed to further debug any errors
});
}
}
};
import firebase from 'firebase/app';

export default {

props: {
authApi: {type: Object, required: true}
},
methods: {
googleSignIn: function() {
const provider = new firebase.auth.GoogleAuthProvider();
console.log(firebase);
firebase
.auth()
.signInWithPopup(provider)
.then((result) => {
const token = result.credential.accessToken;
const user = result.user;
console.log(token); // Token
console.log(user); // User that was authenticated
})
.catch((err) => {
console.log(err); // This will give you all the information needed to further debug any errors
});
}
}
};
Any idea why I get an error
[Vue warn]: Error in v-on handler: "TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0__.default is undefined"

found in

---> <Auth> at src/controllers/auth.vue
<App> at node_modules/@trikoder/trim/src/js/components/appView.vue
<Root>
[Vue warn]: Error in v-on handler: "TypeError: firebase_app__WEBPACK_IMPORTED_MODULE_0__.default is undefined"

found in

---> <Auth> at src/controllers/auth.vue
<App> at node_modules/@trikoder/trim/src/js/components/appView.vue
<Root>
Here I initialize my firebase here in main.js
const firebaseConfig = {
//firebase config stuff
};
initializeApp(firebaseConfig);
const firebaseConfig = {
//firebase config stuff
};
initializeApp(firebaseConfig);
This happens when I click the button and try to initalize the singin
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server