Last active
March 22, 2017 20:40
-
-
Save samueljmurray/a0c937573eb6464b05aa74e89a281c20 to your computer and use it in GitHub Desktop.
Session create action
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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