class Api::V1::ApplicationController < ActionController::Base
  include ApiDefaults
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery with: :null_session
end
class Api::V1::ApplicationController < ActionController::Base
  include ApiDefaults
  # Prevent CSRF attacks by raising an exception.
  # For APIs, you may want to use :null_session instead.
  protect_from_forgery unless: -> { request.format.json? }
end
Modify API application controller to skip csrf protection when requesting JSON
Modify API application controller to skip csrf protection when requesting JSON
