From 88266a50e5fa818578b23b92fa79f08a09759edb Mon Sep 17 00:00:00 2001 From: "Elizabeth (Lizzy) Hunt" Date: Mon, 20 Nov 2023 12:25:36 -0700 Subject: [PATCH] grab authorization header rather than post message --- lib/chessh/web/web.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/chessh/web/web.ex b/lib/chessh/web/web.ex index af70ebb..26385df 100644 --- a/lib/chessh/web/web.ex +++ b/lib/chessh/web/web.ex @@ -291,7 +291,10 @@ defmodule Chessh.Web.Endpoint do end post "/bots/games/:id/turn" do - token = conn.body_params["token"] + token = + Enum.find_value(conn.req_headers, fn {header, value} -> + if header === "authorization", do: value + end) attempted_move = conn.body_params["attempted_move"] bot = Repo.one(from(b in Bot, where: b.token == ^token))