Help Setting Up Authentication



I am trying to follow this tutorials:

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?



Use the debugger or console to see what this returns.


If it’s empty just follow the stack until you find where it’s not being set, probably a malformed cookie or a typo somewhere in the code.