Skip to content

Instantly share code, notes, and snippets.

@samdvr

samdvr/test.ex Secret

Last active February 25, 2018 21:20
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 samdvr/2a6a0ddfab1a658d18319fce540a224d to your computer and use it in GitHub Desktop.
Save samdvr/2a6a0ddfab1a658d18319fce540a224d to your computer and use it in GitHub Desktop.
test
def kab(conn, %{"token" => token}) do
case ApiTrangell.Guardian.decode_and_verify(token) do
{:ok,claims} -> json conn, %Person{token: "test for test"}
{:error, any} -> conn
|> put_status(403)
|> json %{ error: "unauthorized"}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment