Hi all,
I've used Firebase in 2.x.x and it looks like the changes to 3.x.x bring up a lot more questions and confusion about how the API is supposed to work. Right now, I have an app that restricts users based on their Facebook ID before touching firebase. Then on top of all of this, I have pages protected entirely unless the user is logged in and is part of a select few FB user IDs. So for example, one page is an 'edit' page:
res.render('edit', {
playName: req.params.playName,
title: req.params.playName.replace(/_/g, ' '),
currIndex: req.params.currIndex,
yaml: req.yaml,
firebaseToken: tokenGenerator.createToken({uid:"admin"})
});
};
which passes in a firebase token that gets generated with a uid. (Right now, I was still confused about making user systems so I hard-coded uid for all facebook users with access since this was a small app).
The jade view for this would have
firepadRef = firepadRef.child('#{playName}');
firepadRef.authWithCustomToken("#{firebaseToken}", function(err, authData){
if(err){
console.log("Login Failed!", err);
} else {
console.log("Login Succeeded!", authData);
}
});
which took in that custom token which allows the user read/write access to a specific item.
I don't understand how to do the same thing in v3 at the moment or what actual best practices are for handling users and setting up roles. In particular, being able to create objects that particular groups have access to, and having users be assigned to groups. So far, I can't find any good resources on that, especially when I need to integrate a third-party auth. I use passportjs to set up facebook authentication, and that gives me a specific user id / user token -- and not sure how to set that up with firebase correctly for database stuff.
A lot of posts ask about nodeJS access with auth access to the back end and it seems to be that you need to create a service account to do this (I don't really want to do that). Does this mean I should stick to 2.x.x for now?