Skip to content

Instantly share code, notes, and snippets.

@shahryarjb
Created February 25, 2018 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shahryarjb/177bd79cc638d558116fcefea7810f5a to your computer and use it in GitHub Desktop.
Save shahryarjb/177bd79cc638d558116fcefea7810f5a to your computer and use it in GitHub Desktop.
def kab(conn, %{"token" => token}) do
case ApiTrangell.Guardian.decode_and_verify(token) do
{:ok,claims} ->
IO.puts claims
json conn, %Person{token: "verify"}
{:error, any} -> conn
|> put_status(403)
|> json %{ error: "unauthorized"}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment