Skip to content

Instantly share code, notes, and snippets.

@samueljmurray
Last active March 22, 2017 20:40
Show Gist options
  • Save samueljmurray/a0c937573eb6464b05aa74e89a281c20 to your computer and use it in GitHub Desktop.
Save samueljmurray/a0c937573eb6464b05aa74e89a281c20 to your computer and use it in GitHub Desktop.
Session create action
def create(conn, %{"jwt" => jwt}) do
auth0_pk = Application.get_env(:backend, :auth0)[:public_key]
case Guardian.decode_and_verify(jwt, %{secret: auth0_pk}) do
{:ok, decoded_jwt} -> login_with_auth0_token(conn, decoded_jwt)
{:error, _} -> unauthorized(conn, %{})
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment