admin管理员组文章数量:1414096
I got this TypeError: WEBPACK_IMPORTED_MODULE_4__firebase.c.auth is not a function
The line i got an error is the first line.
firebase.auth().createUserWithEmailAndPassword(email, password).then(authUser => {
// Create a user in your own accessible Firebase Database too
db.doCreateUser(authUser.user.uid, username, email, gender, coin, followers, followings)
.then(() => {
this.setState(() => ({ ...INITIAL_STATE }));
history.push("/");
})
.catch(error => {
this.setState(updateByPropertyName('error', error));
});
})
.catch(error => {
this.setState(updateByPropertyName('error', error));
});
//To prevent reloading of page after submit
event.preventDefault();
<Redirect to="/"/>;
}
I'm trying to create user with email and password using firebase authentication. Also, i am adding all the info from the input to firebase realtime database. I've searching for an answer and all came out as nothing. Anyone know how to fix??
I got this TypeError: WEBPACK_IMPORTED_MODULE_4__firebase.c.auth is not a function
The line i got an error is the first line.
firebase.auth().createUserWithEmailAndPassword(email, password).then(authUser => {
// Create a user in your own accessible Firebase Database too
db.doCreateUser(authUser.user.uid, username, email, gender, coin, followers, followings)
.then(() => {
this.setState(() => ({ ...INITIAL_STATE }));
history.push("/");
})
.catch(error => {
this.setState(updateByPropertyName('error', error));
});
})
.catch(error => {
this.setState(updateByPropertyName('error', error));
});
//To prevent reloading of page after submit
event.preventDefault();
<Redirect to="/"/>;
}
I'm trying to create user with email and password using firebase authentication. Also, i am adding all the info from the input to firebase realtime database. I've searching for an answer and all came out as nothing. Anyone know how to fix??
Share Improve this question asked Jun 18, 2018 at 16:23 LillianLillian 1432 silver badges5 bronze badges 2- 1 what version of firebase js sdk are you using, and have you make sure you included auth related js? – William Chong Commented Jun 18, 2018 at 16:56
- Yes, I did. I think there is some plication here because there is firebase-admin at server.js. This is all I can e out with. – Lillian Commented Jun 23, 2018 at 18:36
3 Answers
Reset to default 1Yes because you have not created an instance of the Google provider.
const provider = new firebase.auth.GoogleAuthProvider();
now your code will execute
firebase
.auth()
.signInWithRedirect(provider)
.then((result) => console.log(result))
.catch((errors) => console.log(error));
More Info could be found here : firebase - link
Did you import firebase correctly?
import * as firebase from 'firebase';
You have called a firebase method prior to initializing firebase firebase.init(config);
本文标签: javascriptfirebase auth is not a functionStack Overflow
版权声明:本文标题:javascript - firebase auth is not a function - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744747932a2622999.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论