I'm using firebase auth system for login with facebook on my ionic app.
I'm trying to get profile data and save it into database after user login with database. You can check the how can i to do that with the following code.
User can login successfully but can not set data into database. How can i solve that?
loginWithFacebook() {
this.facebook.login(['email']).then((response) => {
let credintial = firebase.auth.FacebookAuthProvider.credential(response.authResponse.accessToken);
firebase.auth().signInWithCredential(credintial).then(info => {
this.userEmail = info['email'];
this.userName = info['displayName'];
this.userUid = info['uid'];
});
});
this.afDatabase.database.ref(`dump/${this.userUid}`).set({
username: this.userName,
email: this.userEmail,
uid: this.userUid,
wallet: 0
}).then(data => {
this.navCtrl.setRoot(TabsPage);
});
}