diff options
author | Elizabeth (Lizzy) Hunt <elizabeth.hunt@simponic.xyz> | 2023-11-20 12:25:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-20 12:25:36 -0700 |
commit | 88266a50e5fa818578b23b92fa79f08a09759edb (patch) | |
tree | 2e4c8d0427205681bb8f201fec59cb3c7169827c | |
parent | fcef09f1043f27c97d7b34b4330528f0700662a3 (diff) | |
download | chessh-88266a50e5fa818578b23b92fa79f08a09759edb.tar.gz chessh-88266a50e5fa818578b23b92fa79f08a09759edb.zip |
grab authorization header rather than post message
-rw-r--r-- | lib/chessh/web/web.ex | 5 |
1 files changed, 4 insertions, 1 deletions
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)) |