title: API Design: HTTP Basic Authentication vs API Token
body: <p>I'm currently creating an authentication system on front of a public web API for a web application. Given that each user account has an API key and each request must be authenticated, I have two alternatives:</p>
  
  <ol>
  <li><p>Using an HTTP Basic Authentication, <a href="http://developer.github.com/guides/basics-of-authentication/" rel="noreferrer">like GitHub does</a>.</p>
  
  <p>Requests must be sent to the URL</p>
  
  <pre><code>http://api.example.com/resource/id
  with basic authentication
  username: token
  password: the api key
  </code></pre></li>
  <li><p>Passing the API Token as querystring parameter.</p>
  
  <p>Requests must be sent to the URL</p>
  
  <pre><code>http://api.example.com/resource/id?token=api_key
  </code></pre></li>
  </ol>
  
  <p>There's also a third option which is passing the token within the URI, but I honestly don't like that solution.</p>
  
  <p>Which solution would you adopt and why?</p>