title: Angular 2 (4/5) check if user authenticated, best practices
body: <p>I am new to Angular and implementing authentication for users.</p>
  
  <p>Most of suggestions on the web propose to save session/username in local storage and when user is back to the app, check local storage in order to display proper navigation (in my navbar I have different nav buttons for private and public views).</p>
  
  <p>However, I found this solution having some drawbacks. For example, if session on server expired, or local storage was manually added, then when app will be initialising, it will show wrong buttons in navbar.</p>
  
  <p>After that I came to solution - to use service before showing navbar buttons, to send request to server to verify if user from local storage with his session is currently active. And only after that I will display nav buttons.</p>
  
  <p>Here comes a question: is it the most efficient way to proof check if user from local storage is logged in and session is active?</p>
  
  <p>There is another way, which I was thinking, but didn't find solution.
  Since my angular webapp and nodejs server are located in two different places, is it possible for the webapp to check authentication status (make a request from webapp server to my nodejs server) when index.html is requested and respond with pre-rendered navbar and user status (logged in or not)?</p>
  
  <p>Thanks.</p>
  
  <p>P.S. I am using PassportJS and Express on server side.</p>