0

我正在尝试使用门卫向提供商发送发布请求。我创建了应用程序和令牌,我对 api 的获取请求运行良好:

access_token.get("/api/v1/groups")

但是这篇文章给了我一个很长的错误,其中包括 InvalidAuthenticityToken 错误。

access_token.post("/api/v1/groups", params: {group: {title: "Title 1"}})

我在这里发布错误发布请求错误链接

这是我的控制器:

module Api
module V1
    class GroupsController < BaseController
        doorkeeper_for :all

        def index
            render json: current_user.groups
        end

        def create
            render json: current_user.groups.create(group_params)
        end

        private
        def group_params
            params.require(:group).permit(:title, :description, :header_image, :privatization, :amount, :currency, :rate, :max_paiment)
        end
    end
end
end

任何反馈将不胜感激,谢谢!

4

1 回答 1

1

放入protect_from_forgery with: :null_session您的控制器应该可以解决问题

于 2014-08-14T11:43:04.973 回答