Rails 3 disabling session cookies

前端 未结 10 1884
梦如初夏
梦如初夏 2020-11-30 00:06

I have RESTful API written on RoR 3. I have to make my application not to send \"Set-Cookie header\" (clients are authorizing using auth_token parameter).

I have tri

10条回答
  •  有刺的猬
    2020-11-30 00:34

    # frozen_string_literal: true
    
    module Api
      module Web
        module Base
          class WebApiApplicationController < ApplicationController
    
            include DeviseTokenAuth::Concerns::SetUserByToken
            include Api::Concerns::ErrorsConcern
    
            devise_token_auth_group :user, contains: %i[api_web_v1_user]
            respond_to :json
            serialization_scope :current_user
    
            before_action :METHOD_NAME
    
            private
    
            def METHOD_NAME
              request.session_options[:skip] = true
            end
    
          end
        end
      end
    end
    

    It's working for me.

提交回复
热议问题