I am working on a Rails application where details are fetched from facebook. I have fetched the details from facebook. But when I refresh the webpage I got an error called CSRF detected. I have used some methods but all of them have failed.
The facebook Graph API is used in edit action.
These were added in inside class of Employees Controller.
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 authenticate_user is used(4th and 5th cases) I got an argument error,
Before process_action callback :authenticate_user has not been defined
.
In all other cases, the error when refreshing the page just after updating the page using facebook was
OmniAuth::Strategies::OAuth2::CallbackError
csrf_detected | CSRF detected
PS: I have used 'omniauth-facebook' and 'koala' gem for the integration.
I had this problem earlier, I tried the verify authenticity token earlier but it only worked out when I redirected the page So I request you to just redirect the page.