This repository has been archived by the owner on Mar 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 256
Getting "Can't verify CSRF token authenticity" with Rails api_only project #208
Comments
Ok, I just tried with Rails 5.1.4 and it is working. So it is something with 5.2.0.rc1.. |
Your example can be fixed this way: # app/controllers/user_token_controller.rb
class UserTokenController < Knock::AuthTokenController
skip_before_action :verify_authenticity_token
end It seems to me that #184 should fix it directly in the gem. |
I had to use the fix stated in #205 , but it worked. Thanks! |
I had to use both the fix @ledermann and the fix from #205 aswell to make my knock work. Thanks for figuring it out people! 👍 |
Why do you skip |
|
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I'm trying to use Knock with Rails api_only app.
I have started a new project with command
rails new backend --api
(I started over twice to be sure, 5.2.0.rc1).I have add this code:
When I run
curl -v http://localhost:3000/tests/index
I get this, which is ok:But when I want to ask for the token with this:
curl --data "auth[email][email protected]&auth[password]=pass" http://localhost:3000/user_token
I'm getting:and in my log there is
Can't verify CSRF token authenticity. Completed 500 Internal Server Error in 96ms
Should not the command
rails new backend --api
generate a project without CSRF?Thanks
The text was updated successfully, but these errors were encountered: