I am trying to follow this tutorials: http://log.simplabs.com/post/57702291669/better-authentication-in-ember-js
I successfully got up to the point where we setup the ajaxfilter. I tried setting the ajaxfilter but whenever an ajax call is made, the
X-Authentication-Token header is just blank. (I checked in chrome dev tools).
Here is my code:
Ember.$.ajaxPrefilter (options, originalOptions, jqXHR) -> if !jqXHR.crossDomain jqXHR.setRequestHeader 'X-Authentication-Token', CounterStrike.Session.get('auth_token')
I put that file in my app.js, underneath
window.CounterStrike = Ember.Application.create().
I have narrowed the issue down to the fact that in the code above
CounterStrike.Session.get('auth_token') is undefined because I think the Session controller hasnt loaded. Is there a way I can modify that code to make it so that it runs after the controller load or something?