gmailLogin(){
this.googlePlus.login({
'scopes': '', // optional, space-separated list of scopes, If not included or empty, defaults to `profile` and `email`.
'webClientId': '--mykey--', // optional clientId of your Web application from Credentials settings of your project - On Android, this MUST be included to get an idToken. On iOS, it is not required.
'offline': true
})
.then( res => {
firebase.auth().signInWithCredential(firebase.auth.GoogleAuthProvider.credential(res.idToken))
.then( success =>{
this.userProfile = success;
this.values.isLoggedIn = true;
console.log("Firebase Success" + JSON.stringify(success));
firebase.database().ref('/users').child(this.userProfile.uid).set({
displayName: this.userProfile.displayName,
photoURL: this.userProfile.photoURL,
email: this.userProfile.email,
lastName: "",
address: "",
phone: "",
//facebook: false,
//secondLogin:false
});
this.service.getUserProfile(this.userProfile.uid).on('value', (snapshot) =>{
this.userProfiles = snapshot.val();
});
this.values.userRole = firebase.database().ref('/users').child(this.userProfile.uid).on('value', snapshot =>{
if(snapshot.val()){
this.values.userRole = snapshot.val().role;
}
});
this.nav.navigateRoot(['/tabs/home']);
}).catch( error =>{
this.userProfile = error;
this.functions.showAlert('Error', error.message);
console.log("Firebase Failure" + JSON.stringify(error))
});
});
}
So this is my code whenever i login through my google account the user with the uid is generated on my /user in my database but it wont update the data i get from my google account instead gives me error (below) , i do get logged in and the session is with same user only and when i console log the success object i am fetching all the details but it wont set or update the data in my database. i check the Ref URL as well it is all fine :- What iam i doing wrong ?