Kadir Kalkan
Kadir Kalkan

Reputation: 248

Rails protect_from_forgery has not been defined

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.

Upvotes: 0

Views: 855

Answers (1)

Felipe Zavan
Felipe Zavan

Reputation: 1793

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

Upvotes: 0

Related Questions