abuiles/rails-csrf

CSRF in meta tag

joshpfosi opened this issue · 4 comments

Hi, I'm trying to use the below code

App.ApplicationAdapter = DS.ActiveModelAdapter.extend({
  headers: Ember.computed(function(){
    var token = Ember.$('meta[name="csrf-token"]').attr('content');

    return {"X-CSRF-Token": token};
  })
});

but in my Ember app, the csrf token is not defined in a meta tag I suppose? Bottom line is token is always undefined. Still learning here, but I followed the README exactly (no extra steps). What steps must I take to embed this into html?

I have an ember-cli / rails backend set up.

@joshpfosi manage to solve this? I am on the same boat

No! I tabled it since this issue, but cannot solve it!

@joshpfosi @krzkrzkrz at the moment there is no option to configure that, you can easily copy this and customize it to your own app :).

@abuiles what do you mean by "there is no option to configure that"? What is "that" in reference to?