I’m trying to use the CORS Plug in an application of the phoenix elixir and even configuring everything according to the documentation I’m getting this error and I don’t know what else to do, I looked for several solutions.
Note: I am requesting an api through a post form
# no case clause matching: {:ok, %HTTPoison.Response{body: "# Plug.CSRFProtection.InvalidCSRFTokenError at POST /api/v1/valid/index\n\nException:\n\n ** (Plug.CSRFProtection.InvalidCSRFTokenError) invalid CSRF (Cross Site Request Forgery) token, please make sure that:\n \n * The session cookie is being sent and session is loaded\n * The request include a valid '_csrf_token' param or 'x-csrf-token' header\n (plug) lib/plug/csrf_protection.ex:309: Plug.CSRFProtection.call/2\n (fluxo_ideal) FluxoIdealWeb.Router.browser/2\n (fluxo_ideal) lib/fluxo_ideal_web/router.ex:1: FluxoIdealWeb.Router.__pipe_through1__/1\n (phoenix) lib/phoenix/router.ex:347: Phoenix.Router.__call__/2\n (fluxo_ideal) lib/fluxo_ideal_web/endpoint.ex:1: FluxoIdealWeb.Endpoint.plug_builder_call/2\n (fluxo_ideal) lib/plug/debugger.ex:132: FluxoIdealWeb.Endpoint.\"call (overridable 3)\"/2\n (fluxo_ideal) lib/fluxo_ideal_web/endpoint.ex:1: FluxoIdealWeb.Endpoint.call/2\n (phoenix) lib/phoenix/endpoint/cowboy2_handler.ex:64: Phoenix.Endpoint.Cowboy2Handler.init/4\n (cowboy) /Users/gabriel/Desktop/trello-elixir/deps/cowboy/src/cowboy_handler.erl:41: :cowboy_handler.execute/2\n (cowboy) /Users/gabriel/Desktop/trello-elixir/deps/cowboy/src/cowboy_stream_h.erl:320: :cowboy_stream_h.execute/3\n (cowboy) /Users/gabriel/Desktop/trello-elixir/deps/cowboy/src/cowboy_stream_h.erl:302: :cowboy_stream_h.request_process/3\n (stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3\n \n\n## Connection details\n\n### Params\n\n %{\"data\" => %{\"token\" => \"a\"}}\n\n### Request info\n\n * URI: http://localhost:4000/api/v1/valid/index\n * Query string: \n\n### Headers\n \n * content-length: 22\n * content-type: application/json\n * host: localhost:4000\n * user-agent: hackney/1.15.2\n\n### Session\n\n %{}\n", headers: [{"cache-control", "max-age=0, private, must-revalidate"}, {"content-length", "1786"}, {"content-type", "text/markdown; charset=utf-8"}, {"date", "Tue, 19 May 2020 17:35:25 GMT"}, {"server", "Cowboy"}, {"x-request-id", "FhB-eN5F7NR3YwcAADzB"}], request: %HTTPoison.Request{body: "{\"data\":{\"token\":\"a\"}}", headers: [{"Content-type", "application/json"}], method: :post, options: [], params: %{}, url: "http://localhost:4000/api/v1/valid/index"}, request_url: "http://localhost:4000/api/v1/valid/index", status_code: 403}}