title: How to share authentication between ASP.NET MVC and ASP.NET WEB API applications?
body: <p>I am building an AngularJS MVC application, I need some guidance in terms of authentication. I am thinking of building the Authentication using the MVC authentication pipeline. AngularJS code will reside in the MVC application and the root SPA view would be a Razor cshtml. Here is my scenario -</p>
  
  <ul>
  <li>Login page will call a Authenticate API that would return a token </li>
  <li>AngularJS has the logic to get the bearer and pass to each of the API requests</li>
  <li>There will be multiple ASP.NET WebAPI projects that will be hosted as subdomains.</li>
  <li>I also need to call complex dynamic razor templates, this would need the authentication for the MVC controller that will return the razor views. Since MVC follows cookie based authentication, the token gives a 401 status code. How would this work wherein the authentication is shared between MVC and WEB API apps. </li>
  </ul>