railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.89k stars 2.25k forks source link

logout_path should be configurable #3660

Open siba2893 opened 10 months ago

siba2893 commented 10 months ago

Describe the bug Currently I have Devise Token Auth for my API para of the app. But because configuring devise to work with Active Admin without overlapping with the parent controller of both Devise instances is a nightmare. I went and used Sorcery for the auth on the Rails Admin side.

The problem is that Rails Admin is tightly coupled to Devise for the logout_path. In my specific scenario I do have Devise defined so the code

 def logout_path
      if defined?(Devise)
        scope = Devise::Mapping.find_scope!(_current_user)
        begin
          main_app.send("destroy_#{scope}_session_path")
        rescue StandardError
          false
        end
      elsif main_app.respond_to?(:logout_path)
        main_app.logout_path
      end
    end

Will always try to go that way. Leaving me without a way to use my own logout url.

mshibuya commented 10 months ago

~What prevents you from defining logout_path as a route?~ https://github.com/railsadminteam/rails_admin/pull/2062

Ah sorry, you do have Devise so logout_path won't be taken into account.