sorcery
sorcery copied to clipboard
Using sorcery in an API-only rails app does not work
Configuration
- Sorcery Version:
0.16.4
- Ruby Version:
3.1.2
- Framework:
rails-7
- Platform:
linux-64_86
Expected Behavior
Sorcery should work out of the box with an API-only rails app
Actual Behavior
It errors with undefined local variable or method 'form_authenticity_token'
.
Steps to Reproduce
- Make a rails API app
- Install sorcery
- Call
login
Potentially related issues (some closed): #242 #203
Login method calls form_authenticity_token
which is defined in request forgery protection concern. You can include it with:
include ActionController::RequestForgeryProtection
@mladenilic saved me some work here, thanks!