Rails protect_from_forgery has not been defined

695 Views Asked by At

I'm new at rails so maybe this is so basic and that's why I couldn't find anything about it. But anyways I stuck at here and I need help.

I updated a rails 4 application to rails 6 and when I try to sign_in it throws this error.

ArgumentError at /v1/auth/sign_in
=================================

Before process_action callback :protect_from_forgery has not been defined

I'm using devise 4.8.1 and devise_token_auth 1.2.0 but I couldn't found any solution for this problem. I tried many things but any of them didn't worked.

1

There are 1 best solutions below

1
On

Remove protect_from_forgery from your controllers. Rails >=5.2 already has :protect_from_forgery on ActionController::Base by default.