title: Spring Security Angularjs + Android REST
body: <p>I am wondering what is the best approach to implement Spring Security to secure a REST api that will be accessed by two types of clients, Angularjs and Android.</p>
  
  <p>I have read many sources online in search of the perfect answer but I have not found what I am looking for (as of yet).</p>
  
  <p>Ideally, the two clients will go through the exact same authentication process so that the one set of code is easily maintainable (Hence, the reason I am developing in Angularjs - so that both clients can share the same code base). I assume that I will be lead down the oauth2 route and have the token being passed with every api call once authentication has occurred but as I said, this is an assumption. </p>
  
  <p>I have also come across JSESSION mentioned here and there but nothing too detailed that I could grasp the concept 100%.</p>
  
  <p>I am not looking for the easy way out as I have spent a lot of the day researching this. I am a student so I am do not have the most in depth knowledge but if I can could get pointed in the right direction that I would highly appreciate it.</p>
  
  <p>Some of the sources include - although there were a LOT more:
  <a href="https://spring.io/blog/2015/02/03/sso-with-oauth2-angular-js-and-spring-security-part-v" rel="nofollow">https://spring.io/blog/2015/02/03/sso-with-oauth2-angular-js-and-spring-security-part-v</a>
  <a href="http://automateddeveloper.blogspot.co.uk/2014/03/securing-your-mobile-api-spring-security.html" rel="nofollow">http://automateddeveloper.blogspot.co.uk/2014/03/securing-your-mobile-api-spring-security.html</a> 
  <a href="https://github.com/spring-projects/spring-android-samples/tree/master/spring-android-basic-auth" rel="nofollow">https://github.com/spring-projects/spring-android-samples/tree/master/spring-android-basic-auth</a></p>
  
  <p>What is the ideal implementation to authenticate these different REST clients?</p>