title: API protection - JWT vs HMAC signing vs OAuth
body: <p>Lets say you are designing a new API. The consumer of your API is a mobile app that periodically sends requests in the background, but you expect other consumers as well, such as web apps or servers.</p>
  
  <p>Now lets consider two schemes:</p>
  
  <p>In scheme number one, you create a login endpoint that accepts your username and password, and in response issues a short-lived JWT.</p>
  
  <p>In scheme number two, the client of the API uses an HMAC signature to sign each request, just like 
  <a href="http://s3.amazonaws.com/doc/s3-developer-guide/RESTAuthentication.html" rel="nofollow noreferrer">Amazon protect their API</a></p>
  
  <p>How would you compare the two? it seems that scheme number two is more computationally intensive for the API client, but in both schemes it all boils down to one secret key/password that you must keep on your device or server. How does it make scheme number two more secure?</p>
  
  <p>Then you have scheme number three which is OAuth2, but does it make sense if there is no third-party involved?</p>
  
  <p>Thanks.</p>