I'm currently looking at using Firebase to authenticate users for my app; my knowledge is as follows:Firebase authenticates users client sideTo communicate with my server (aka, return posts by this specific user), I need to send a request to my server containing a token generated from the logged-in user client side. My server then is able to derive the specific user ID of the token and send back the corresponding information.If a logged in user loads the page /home, there is nothing included in the request to my server for /home that has any data about that specific user so I can not do any server-side rendering of user specific data.Currently, my authentication system is the passport middleware, which will store an user object that is included in every request if a user is logged in; therefore, my server can pull up relevant data, put it through a templating engine, and send the completed page to the user (ie, for a homepage/summary) rather than sending an empty page that then has to send more requests in order to populate the data.Is there any way I could include the Firebase client token (which is generated by the clientside firebase code on page load) in the request information so I don't have to send XHR requests on page load (as looking at an incomplete screen is visually unappealing/longer load times/heavier on client CPU)?As far as the research I've looked it, it is partially possible (there are firebase passport libraries - however these only support email/password logins I believe and are not recommended since Firebase will limit the amount of logins per hour on the same IP), but was wondering if anyone else had this problem before.Let me know if there is anything I can clarify.
Submitted October 15, 2018 at 07:35PM by Stormy1997
No comments:
Post a Comment