Is it possible to implement Rails csrf through cookie_store at the same while using ember-simple-auth Devise?
Guides like this one always deactivate Rails.application.config.session_store
which from my understanding does not allow Rails to keep track of csrf tokens which causes Rails to lose track of sessionsg. After attempting many solutions including:
require jquery_ujs
on Rails manifesto.Rails.application.config.session_store :disabled
.- https://github.com/abuiles/rails-csrf.
- Changing Ember.js Adapter to append CSRF.
The end result is still pretty much the same:
Can't verify CSRF token authenticity followed by Completed 422 Unprocessable Entity if protect_from_forgery is set with :exception instead of :null_session.
Example Transaction:
Partial Request HEADER:
X-CSRF-Token:1vGIZ6MFV4kdJ0yYGFiDq54DV2RjEIaq57O05PSdNdLaqsXMzEGdQIOeSyAWG1bZ+dg7oI6I2xXaBABSOWQbrQ==
Responder HEADER
HTTP/1.1 422 Unprocessable Entity
Content-Type: text/plain; charset=utf-8
X-Request-Id: 71e94632-ad98-4b3f-97fb-e274a2ec1c7e
X-Runtime: 0.050747
Content-Length: 74162
The response also attaches the following:
Session dump
_csrf_token: "jFjdzKn/kodNnJM0DXLutMSsemidQxj7U/hrGmsD3DE="
The rails-csrf response from my csrf branch (branch has been deleted).
beforeModel() {
return this.csrf.fetchToken();
},
Partial dump of the return statement:
_result: Object
param: "authenticity_token"
token: "1vGIZ6MFV4kdJ0yYGFiDq54DV2RjEIaq57O05PSdNdLaqsXMzEGdQIOeSyAWG1bZ+dg7oI6I2xXaBABSOWQbrQ=="
From my understanding, all of these attempted solutions have the common root: session_store is disabled...