I am trying to send a post request to the provider using doorkeeper. I created the application and token, my get request to the api works perfectly:
access_token.get("/api/v1/groups")
But the post gives me a long error which includes InvalidAuthenticityToken error.
access_token.post("/api/v1/groups", params: {group: {title: "Title 1"}})
I post the error here post request error link
This is my controller:
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
Any feedback will be really appreciated, Thanks!
putting protect_from_forgery with: :null_session
in your controller should solve the problem