I am currently developing a mobile app using Ionic 3 with Angular, and I am utilizing the Facebook Native Cordova plugin for user login.
In terms of Firebase database security, the documentation provides guidance on rules syntax like this:
{
"rules":{
"users":{
"$user_id":{
".write":"$user_id === auth.id"
}
}
}
}
Within my app, the Facebook authentication code looks something like this:
doLogin(){
if (this.platform.is('cordova')) {
return this.fb.login(['email', 'public_profile']).then(res => {
const facebookCredential = firebase.auth.FacebookAuthProvider.credential(res.authResponse.accessToken);
firebase.auth().signInWithCredential(facebookCredential);
this.navCtrl.setRoot(TabsPage);
})
}
}
My question is whether the 'auth' Firebase variable is properly handled in the above code, or if additional coding is required to ensure that the necessary UID and other authentication details are obtained?