Error 422: InvalidAuthenticityToken for current_user #43
-
Hello @Gokul595 and Team. Inside TaskController I have:
The response that I get when I try to POST data on tasks#create:
The token is on localStorage It works when I GET but is not working to POST.
Thanks for your time. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
@jessicafarias This is a default behaviour of Rails for non https://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html |
Beta Was this translation helpful? Give feedback.
@jessicafarias This is a default behaviour of Rails for non
GET
requests to protect from CSRF attacks, and not related to API Guard. You can refer below link to know how to skip this check for API requests.https://api.rubyonrails.org/classes/ActionController/RequestForgeryProtection.html