For each page of my application, I need to check if is there a logged user (through Firebase) before rendering the page.
In each scenario (logged user or not), I need to render a different page.
What's the best way to do that in JavaScript?
P.S.: thought of rendering a blanck page first, then from this page request the real one and insert in this request the user token. That way, the server would have the user token when it were going to render the real page. The problem with this approach is that I would completely lose my search ranking capabilities, as Google would have no clue what my blank page (initially rendered) is about. I would even lose the meta tags that tell other services, like WhatsApp, what the page is about.
SOLUTION:
Just found out I can reach what I intend with cookies, because they get sent to the server with every request. So I call the onAuthStateChanged method, save the token in a cookie and then I don't need to do that again in the next requests, cause the token will already be sent to my server in every following request.