I've originally asked about this in #authentication-archive but then it was archived so I'm moving the discussion here (as it still unresolved).
---------------------
Hey guys, I'm trying to setup github authentication. I followed the guide but it doesn't work when I click " Sign in with Github " it opens
http://localhost:4000/auth/user/github
http://localhost:4000/auth/user/github
but doesn't redirect. I guess I should change something in my router?
# lib/open_status_web/router.exdefmodule OpenStatusWeb.Router do use OpenStatusWeb, :router use AshAuthentication.Phoenix.Router pipeline :browser do plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_live_flash) plug(:put_root_layout, {OpenStatusWeb.Layouts, :root}) plug(:protect_from_forgery) plug(:put_secure_browser_headers) plug(:load_from_session) end pipeline :api do plug(:accepts, ["json"]) plug(:load_from_bearer) end scope "/", OpenStatusWeb do pipe_through(:browser) get("/", PageController, :home) live("/test", TestLive) sign_in_route() sign_out_route(AuthController) auth_routes_for(OpenStatus.Accounts.User, to: AuthController) endend
# lib/open_status_web/router.exdefmodule OpenStatusWeb.Router do use OpenStatusWeb, :router use AshAuthentication.Phoenix.Router pipeline :browser do plug(:accepts, ["html"]) plug(:fetch_session) plug(:fetch_live_flash) plug(:put_root_layout, {OpenStatusWeb.Layouts, :root}) plug(:protect_from_forgery) plug(:put_secure_browser_headers) plug(:load_from_session) end pipeline :api do plug(:accepts, ["json"]) plug(:load_from_bearer) end scope "/", OpenStatusWeb do pipe_through(:browser) get("/", PageController, :home) live("/test", TestLive) sign_in_route() sign_out_route(AuthController) auth_routes_for(OpenStatus.Accounts.User, to: AuthController) endend
# lib/open_status/secrets.exdefmodule OpenStatus.Secrets do use AshAuthentication.Secret alias OpenStatus.Accounts.User def secret_for([:authentication, :strategies, :github, :client_id], User, _) do System.get_env("GITHUB_CLIENT_ID") end def secret_for([:authentication, :strategies, :github, :redirect_uri], User, _) do System.get_env("GITHUB_REDIRECT_URI") end def secret_for([:authentication, :strategies, :github, :client_secret], User, _) do System.get_env("GITHUB_CLIENT_SECRET") endend
# lib/open_status/secrets.exdefmodule OpenStatus.Secrets do use AshAuthentication.Secret alias OpenStatus.Accounts.User def secret_for([:authentication, :strategies, :github, :client_id], User, _) do System.get_env("GITHUB_CLIENT_ID") end def secret_for([:authentication, :strategies, :github, :redirect_uri], User, _) do System.get_env("GITHUB_REDIRECT_URI") end def secret_for([:authentication, :strategies, :github, :client_secret], User, _) do System.get_env("GITHUB_CLIENT_SECRET") endend
The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.