CSRF encountered error while updating webpage

I am working on a Rails application in which details are downloaded from facebook. I got the details from facebook. But when I refresh the webpage, I got a CSRF error message. I used some methods, but all of them failed.

The facebook graph API is used in the editing action.

They were added in the inner class of the employee manager.

  • skip_before_action :verify_authenticity_token

  • skip_before_action :verify_authenticity_token, only: [:edit]

  • protect_from_forgery :only => [:edit]

  • skip_before_action :authenticate_user, only: [:edit]

  • skip_before_action :authenticate_user!

When used authenticate_user (4th and 5th cases), I got the error argument Before process_action callback :authenticate_user has not been defined.

In all other cases, the error updating the page immediately after updating the page using facebook was OmniAuth::Strategies::OAuth2::CallbackError

csrf_detected | CSRF detected

PS: I used omniauth-facebook and koala for integration.

+4
2

, , , .

+1

do redirected_to , .

+2

Source: https://habr.com/ru/post/1692696/


All Articles