title: User Authentication in ASP.NET Web API
body: <p>This topic has been incredibly confusing for me. I am a rookie in HTTP apps but need to develop an iPhone client that consumes JSON data from somewhere. I chose Web API from MS because it seemed easy enough but when it comes to authenticating users, things get quite frustrating.</p>
  
  <p>I am amazed how I've not been able to find a clear example of how to authenticate an user right from the login screen down to using the <code>Authorize</code> attribute over my <code>ApiController</code> methods after several hours of Googling.</p>
  
  <p>This is not a question but a request for an example of how to do this exactly. I have looked at the following pages:</p>
  
  <ul>
  <li><a href="http://codebetter.com/johnvpetersen/2012/04/02/making-your-asp-net-web-apis-secure/">Making your ASP.NET Web API's Secure</a></li>
  <li><a href="http://stevescodingblog.co.uk/basic-authentication-with-asp-net-webapi/">Basic Authentication With ASP.NET Web API</a></li>
  </ul>
  
  <p>Even though these explain how to handle unauthorized requests, these do not demonstrate clearly something like a <code>LoginController</code> or something like that to ask for user credentials and validate them.</p>
  
  <p>Anyone willing to write a nice simple example or point me in the right direction, please?</p>
  
  <p>Thanks.</p>