title: How to do OAuth authentication via AJAX / jQuery?
body: <p>I've worked a bit with Twitter web API, I know it works with OAuth, I've consumed the API using a python library. I've also tried a bit of Instagram API using a Java Script small library.</p>
  
  <p>I know those perform web REST requests in the background, authenticating first and then querying requests as I code.</p>
  
  <p><strong>However, what if I want to perform the requets using <code>jQuery</code> <code>$.ajax</code> from a web application?</strong></p>
  
  <p>I've read some docs and sites and it seems it's just possible. Like only ajaxing to the API routes, starting with the authentication route.</p>
  
  <p>But, how does this process work? I mean, I query by AJAX to the auth route and then how do I keep track of that authentication. How to keep that <em>communication</em>? Will the redirect URL play its role then?</p>
  
  <p><a href="http://techmonks.net/instagram-using-the-api/" rel="nofollow">Reading this site for Instagram API</a> I start getting a clue about it, but got the doubts mentioned above.</p>
  
  <p>I want to perform all AJAX requests in the Java Script server background (I'm using <strong>node.js</strong>), assuming I will provide my apps OAuth in the <code>$.ajax</code>. Is that OK or I can actually code it on client site keeping my OAuth tokens save?</p>
  
  <p>And, if it's concern of this same question, when it comes to <em>bytes</em> (pictures, sound, etc) how to <em>catch</em> the response from API.</p>