title: Ember.js Authentication Token for Ember-Data + AMS => JSON or HTTP Header?
body: <p>CONTEXT:</p>
  
  <p>I have an Ember.js 1.1.0-beta.1 application that exchanges JSON data with a Rails-API server (Rails 4).  JSON data exchange is accomplished with Ember-Data 1.0.0-beta.2 and Active Model Serializers 0.8.1 (AMS). I'm using the default recommended configurations for both Ember-Data and AMS, and am compliant with the JSON-API spec.</p>
  
  <p>On any given RESTful call, the client passes the current authentication token to the server. The authentication token is verified and retired, and a new authentication token is generated and sent back to the client. Thus, every RESTful call accepts an authentication token in the request, and provides a new authentication token in the response that the client can cache and use for the next RESTful call.</p>
  
  <p>QUESTION:</p>
  
  <p>Where do I put the authentication token in each request and response?</p>
  
  <p>Should it be part of each object's JSON in request and response?  If so, where is the token placed in the existing object's JSON structure (which has nothing to do with authentication)?</p>
  
  <p>Or should they be placed in the HTTP header for each request and response object?</p>
  
  <p>What is "The Ember Way" that one might eventually expect to find in the new Ember Guides Cookbook?</p>
  
  <p>MORE CONTEXT:</p>
  
  <p>I'm already familiar with the following links:</p>
  
  <ul>
  <li>@machty 2 Embercasts: <a href="http://www.embercasts.com/episodes/client-side-authentication-part-2">http://www.embercasts.com/episodes/client-side-authentication-part-2</a></li>
  <li>@wycats tweet: <a href="https://twitter.com/wycats/status/376495062709854209">https://twitter.com/wycats/status/376495062709854209</a></li>
  <li>@cavneb 3 blog posts: <a href="http://coderberry.me/blog/2013/07/08/authentication-with-emberjs-part-1">http://coderberry.me/blog/2013/07/08/authentication-with-emberjs-part-1</a></li>
  <li>@simplabs blog post: <a href="http://log.simplabs.com/post/53016599611/authentication-in-ember-js">http://log.simplabs.com/post/53016599611/authentication-in-ember-js</a></li>
  </ul>
  
  <p>...and am looking for answers that go beyond these, and are specific to Ember-Data + AMS.</p>
  
  <p>With the exception of the need to pass a new token back to the client in the response via Ember-Data, assume my client code is otherwise similar to the @machty Embercast example on GitHub: <a href="https://github.com/embercasts/authentication-part-2/blob/master/public/js/app.js">https://github.com/embercasts/authentication-part-2/blob/master/public/js/app.js</a></p>
  
  <p>Thank you very much!</p>