title: How do I use only token authentication with Devise making sure no session/cookie mess is going on in the background
body: <p>I'm using Devise with Rails to power the user experience on an Android app. Due to this being an Android app, I won't be using any cookies or sessions. If I choose to pass and store something client-side, I will explicitly do that. Right now, I'm trying to test my Registrations and Sessions controllers, but noticed I run into sessions issues. Namely, I keep getting the <code>requires_no_authentication</code> which somehow spirals me to the Welcome to Rails page. </p>
  
  <p>I figured out this is due to how <code>warden.authenticate!(scope: resource_name, recall: "#{controller_path}#failure"}</code> works. </p>
  
  <p>If that is the case, then how do I make my Registrations and Sessions controllers work as I want?</p>
  
  <p>I've come to the point where I feel like dumping Devise all together and making my own auth solution from scratch.</p>
  
  <p>It seems my Registration works over and over because I don't use <code>warden.authenticate!</code> Once used, it messes with everything due to cookies/sessions.</p>
  
  <p>These are my Registration and Session controllers at the moment:</p>
  
  <p><strong>Session</strong></p>
  
  <pre><code>class Api::V1::SessionsController &lt; Devise::SessionsController
    skip_before_filter :verify_authenticity_token,
                       if: Proc.new { |c| c.request.format == 'application/json' }
  
    respond_to :json
  
    def create
      warden.authenticate!(scope: resource_name, recall: "#{controller_path}#failure")              
  
      render status: 200,
             json: { success: true,
                     info: "Logged in",
                     data: { auth_token: devise_current_user.authentication_token } }
    end
  
    def destroy
      warden.authenticate!(scope: resource_name, recall: "#{controller_path}#failure")
  
      current_user.update_column(:authentication_token, nil)
  
      render status: 200,
             json: { success: true,
                     info: "Logged out",
                     data: {} }
    end
  
    def failure
      render status: 401,
             json: { success: false,
                     info: "Login or Logout Failed",
                     data: {} }
    end
  end
  </code></pre>
  
  <p><strong>Registration</strong></p>
  
  <pre><code>class Api::V1::RegistrationsController &lt; Devise::RegistrationsController
    skip_before_filter :verify_authenticity_token,
                       if: Proc.new { |c| c.request.format == 'application/json' }
  
    before_action :configure_permitted_parameters
  
    respond_to :json
  
    def create
      build_resource(sign_up_params)
  
      if resource.save
        sign_in resource
  
        resource_hash = {
          email: resource.email,
          name: resource.name,
          auth_token: resource.authentication_token,
          external_id: resource.external_id,
          created_at: resource.created_at
        }
  
        render status: 200,
               json: { success: true,
                       info: "Registered",
                       data: { user: resource_hash } }
      else
        render status: :unprocessable_entity,
               json: { success: false,
                       info: "Registration failed",
                       data: resource.errors }
      end
    end
  
    private
  
    def configure_permitted_parameters
      devise_parameter_sanitizer.for(:sign_up) do |u|
        u.permit(:name, :email, :password, :password_confirmation)
      end
    end
  end
  </code></pre>