title: How use token authentication with Rails, Devise and Backbone.js?
body: <p>I'm trying to build a mobile application with PhoneGap, jQuery Mobile and Backbone.js on the client-side - with a Rails 3 JSON API running server-side.</p>
  
  <p>I know how to fetch the token from the server after being authenticated, but I don't know how to append the "token_auth" key/value to all the AJAX-requests Backbone.js will make to my server.</p>
  
  <p>Here's my flow at the moment:</p>
  
  <ol>
  <li>User types in some form fields and hits "Log in"</li>
  <li>Backbone creates a new Player object with the email and password info.</li>
  <li>I run a Player.authenticate that sets the token to AUTHENTICATION_TOKEN</li>
  <li>All requests after this should append "auth_token=" + AUTHENTICATION_TOKEN</li>
  </ol>
  
  <p>I've looked at <a href="http://documentcloud.github.com/backbone/#Sync" rel="noreferrer">http://documentcloud.github.com/backbone/#Sync</a> for maybe overriding the AJAX calls - but that seems quite extreme for this simple task.</p>
  
  <p>Does anyone have any experience with running Devise token_authentication and Backbone.js?</p>