In my rails app I\'m getting \"WARNING: Can\'t verify CSRF token authenticity\" on an ajax post to an api.
app/views/layouts/application.html.haml<
Assuming you've set the CSRF token using the Rails csrf_meta_tag
tag, the request's token will be available in the csrf-token
meta tag:
Since you're using jQuery, you can pass the token to your AJAX request by invoking the following value for the beforeSend
key:
function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))}