Created
          February 20, 2018 16:16 
        
      - 
      
- 
        Save nicolasblanco/4de1b989a928954c4077de098617b416 to your computer and use it in GitHub Desktop. 
Revisions
- 
        Nicolas Blanco created this gist Feb 20, 2018 .There are no files selected for viewingThis file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ defmodule DokkitoWeb.AuthController do use DokkitoWeb, :controller # ... def callback(%{assigns: %{ueberauth_auth: auth}} = conn, _params) do case Auth.find_or_create(auth) do {:ok, user} -> conn |> put_flash(:info, "Successfully authenticated.") |> Guardian.Plug.sign_in(user, key: :user) |> redirect(to: dashboard_home_path(conn, :index)) {:error, reason} -> conn |> put_flash(:error, reason) |> redirect(to: "/") end end end This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ defmodule DokkitoWeb.Plug.GuardianPipeline do use Guardian.Plug.Pipeline, otp_app: :dokkito, module: DokkitoWeb.Guardian, error_handler: DokkitoWeb.Plug.AuthErrorHandler, key: :user plug Guardian.Plug.VerifySession plug Guardian.Plug.EnsureAuthenticated plug Guardian.Plug.LoadResource end 
 Nicolas Blanco
              created
            
            this gist
            
              Nicolas Blanco
              created
            
            this gist