title: Can't verify CSRF token authenticity Rails 4.1
body: <p>I am developing a simple site which lets admins create questions and users solve them. I use ActiveAdmin for the admin part and simple AJAX calls for the user solving part. Trying to login via ActiveAdmin::Devise was successful at first but login out was not possible. I erased all cookies and since then I am not able to make POST actions without a CSRF token authenticity exception. I have the correct meta_tags within the head of my application.html.erb, declared jquery_ujs (other threads say its a common issue) and in both POST actions the authenticity token exists. I tried even avoiding the verification via <em>skip_before_filter :verify_authenticity_token</em> but the ActiveAdmin Login and POST Example continue failing. The logs are below, you can see that the tokens exist. I also show the Gemfile in case that any of those break something with the CSRF.</p>
  
  <ul>
  <li>Rails Version [4.1.0]  </li>
  <li>Ruby Version [2.1]</li>
  <li>Phusion Passenger Version [4.0.41]</li>
  </ul>
  
  <p>Thanks in advance.</p>
  
  <p><strong>application.html.erb</strong></p>
  
  <pre><code>&lt;head&gt;
    &lt;title&gt;Introducción Matematicas&lt;/title&gt;
    &lt;%= stylesheet_link_tag    "application", media: "all"%&gt;
    &lt;%= javascript_include_tag "application", "data-turbolinks-track" =&gt; true %&gt;
    &lt;link href="http://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700|Roboto+Slab:300,400" rel="stylesheet" type="text/css"&gt;
    &lt;%= csrf_meta_tags %&gt;
  &lt;/head&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>application.js</strong></p>
  
  <pre><code>//= require jquery
  //= require jquery_ujs
  //= require_tree ../../../vendor/assets/javascripts/.
  //= require_tree .
  </code></pre>
  
  <p><strong>Aplication Controller</strong></p>
  
  <pre><code>class ApplicationController &lt; ActionController::Base
    # Prevent CSRF attacks by raising an exception.
    # For APIs, you may want to use :null_session instead.
    protect_from_forgery with: :null_session
    #skip_before_filter :verify_authenticity_token
    before_filter :configure_permitted_parameters, if: :devise_controller?
    protected
    def configure_permitted_parameters
        devise_parameter_sanitizer.for(:sign_up) do |u|
          u.permit :name,:college, :email, :password, :password_confirmation
        end
    end
  end
  </code></pre>
  
  <p><strong>Admin Login Log</strong></p>
  
  <pre><code>INFO -- : Processing by ActiveAdmin::Devise::SessionsController#create as HTML
  INFO -- :   Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"aRZK3470X6+FJPANEuHAiwVW4NZwMzCkXtoZ1qlhQ0o=", "admin_user"=&gt;{"email"=&gt;"omar@gmail.com", "password"=&gt;"[FILTERED]", "remember_me"=&gt;"0"}, "commit"=&gt;"Login"}
  WARN -- : Can't verify CSRF token authenticity
  INFO -- : Completed 401 Unauthorized in 110ms
  INFO -- : Processing by ActiveAdmin::Devise::SessionsController#new as HTML
  INFO -- :   Parameters: {"utf8"=&gt;"✓", "authenticity_token"=&gt;"aRZK3470X6+FJPANEuHAiwVW4NZwMzCkXtoZ1qlhQ0o=", "admin_user"=&gt;{"email"=&gt;"omar@gmail.com", "password"=&gt;"[FILTERED]", "remember_me"=&gt;"0"}, "commit"=&gt;"Login"}
  WARN -- : Can't verify CSRF token authenticity
  INFO -- :   Rendered vendor/cache/ruby/2.1.0/bundler/gems/active_admin-a460d8d2ab37/app/views/active_admin/devise/shared/_links.erb (2.0ms)
  INFO -- :   Rendered vendor/cache/ruby/2.1.0/bundler/gems/active_admin-a460d8d2ab37/app/views/active_admin/devise/sessions/new.html.erb within layouts/active_admin_logged_out (73.0ms)
  INFO -- : Completed 200 OK in 302ms (Views: 80.2ms | ActiveRecord: 0.0ms)
  </code></pre>
  
  <p><strong>Simple POST via AJAX Log</strong></p>
  
  <pre><code>INFO -- : Processing by QuestionsController#check_question as JS
  INFO -- :   Parameters: {"utf8"=&gt;"✓", "que_id"=&gt;"44", "authenticity_token"=&gt;"CjaAx+B36JPc1PUIhta0vIuOTKX4UhrFWlmYHAd+KWY=", "question"=&gt;{"id"=&gt;"169"}, "commit"=&gt;"Verificar Respuesta", "id"=&gt;"6"}
  WARN -- : Can't verify CSRF token authenticity
  INFO -- :   Rendered answers/_answer.html.erb (1.2ms)
  INFO -- :   Rendered questions/check_question.js.erb (17.0ms)
  INFO -- : Completed 200 OK in 94ms
  </code></pre>
  
  <p><strong>Gemfile</strong></p>
  
  <pre><code>source 'https://rubygems.org'
  gem 'rails', '4.1.0'
  #gem 'ckeditor'
  gem 'mysql2', "0.3.15"
  gem 'devise'
  gem 'activeadmin', github: 'gregbell/active_admin'
  gem 'sass-rails', '~&gt; 4.0.0'
  gem 'uglifier', '&gt;= 1.3.0'
  gem 'execjs'
  gem 'therubyracer'
  gem 'coffee-rails', '~&gt; 4.0.0'
  gem 'jquery-rails'
  gem 'turbolinks'
  gem 'jbuilder', '~&gt; 1.2'
  group :doc do
    gem 'sdoc', require: false
  end
  gem 'minitest'
  </code></pre>