title: AngularJS best practice application authentication
body: <p>I'm start building a web application where the user needs to authenticate in order to get access to different modules. </p>
  
  <p>I have been working with ASP.NET MVC in the past and it was quite easy using FormsAuthentication and Server Sessions so I don't have to do roundtrips to the database in order to get the user roles or any other user related data everytime I access a web method.</p>
  
  <p>What I have been reading, <strong>AngularJS</strong> won't work that way so there won't be any Server Session, etc.. So...</p>
  
  <ol>
  <li><p>In case I need to verify user identity every time I access a web method do I need to consume database or there is any good practice that I can learn of? </p></li>
  <li><p>I know there are ways to store state data in client side but how that can affect the performance of a web application?</p></li>
  <li><p>I have seen that when a user login to an application the best way is to send a Token to the client and then force AngularJS to send that Token everytime a web method is accessed... but what about sending to the client the user sessionId (from database) and then on every web method consumption sending that and then create a filter where you check that the sessionId exists in the database so the user identify is validated?</p></li>
  </ol>
  
  <p>Appreciate any advice or recommendations.</p>
  
  <p>Thanks.</p>