-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing compatibility with Rails 7 and API mode #5474
base: main
Are you sure you want to change the base?
Conversation
Hey @carlosantoniodasilva , this is a first part of the work to allow API mode to work as well. See #5443. |
Why the hard lock to Rails 7+ ? The PR looks like it will work with Rails 6 without a hitch. |
you are right: but in Rails 6 it would not have any effect because |
I think this is a good hack as bandaid. but I don't think this is a good solution. Some users may be using it in API mode and with sessions enabled. I think it would be broken from those users.
I think the problem is that devise implicitly depends on session.
How about providing an option called Devise.setup do |config|
config.ignore_session = true # default false
end As a side note, there seems to be a similar discussion on warden's side. |
I agree with you. I believe that, before beginning a journey to the "right thing" it would be great to have some blessing from the mantainers, or it will result in a lot of wasted work. |
@morenocarullo I forked and merged in my Devise version for an API ( Rails 7, API Only, JWT Auth). Works like a charm, thanks for your insight. |
Getting
when trying to sign out. Any thoughts? |
Didn't work on rails 7.0.2.3 for me. Works only if comment "load_for_write" line in actionpack's gem at lib/action_dispatch/request/session.rb
I don't know if this is correct in any way.
is it safe?? |
Worked for me. However I'm getting the following error when running LoadError:
cannot load such file -- devise/controllers/rails7_api_mode |
Is this likely to be merged any time soon? Or has anyone discovered an alternative for dealing with the problem this PR solves? |
Any news? |
any updates on merging this solution or providing another one? |
`authenticate_user!` * This is a known issue reported here: heartcombo/devise#5443 * There's also an open PR to devise for fixing it: heartcombo/devise#5474 * If the PR gets merged eventually, this fix/patch won't be necessary anymore.
This PR addresses this issue #5443 .
The test coverage for it is not ideal yet, as we are working to find a good way to have API-mode tests properly integrated (quick hack of forcing it to true does not work).