Help Setting Up Authentication

Hey!

I am trying to follow this tutorials: Product & Engineering Blog | simplabs

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?

Thanks.

Use the debugger or console to see what this returns.

CounterStrike.Session.get('auth_token')

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.