How do I map a Facebook friend id to a Firebase uid in the realtime database? It's my understanding that the Firebase uid is not the same as a Facebook id.
My current user flow is logging into Facebook through the Facebook sdk, and then passing the facebook access token to the Firebase sdk to login with Firebase.
My end goal is to store game scores so that a user can see the scores of their friends as well as their own. I do not want to request every score for every player and filter for this information on the client. I would rather send X queries for X amount of friends and only request the scores desired.
Not sure what the downvote was for, but here is the solution I ended up using.
Storing the scores by facebookId instead of firebaseId allows the lookup of scores of friends, since a facebookId can't be mapped to a firebaseId without storing it in the database anyway. It looks like this:
This structure allows you to easily lookup scores by facebookId, and also map facebookIds to firebaseIds if desired for other operations.
To save scores:
To lookup scores:
To restrict writes based on facebookId, use the following rules:
Hopefully this helps someone more than a downvote.