pow-auth / pow_assent

Multi-provider authentication for your Pow enabled app
https://powauth.com
MIT License
323 stars 50 forks source link

Auth.Strategy.Github is not available #242

Closed rajatksud closed 1 year ago

rajatksud commented 1 year ago

Using elixir 1.14.4 and phx 1.17.2 I am not able to add Github OAuth strategy following the instructions. mix.exs has following deps

 {:pow, "~> 1.0.30"},
 {:pow_assent, "~> 0.4"},

assent 0.1.28 is also installed and can see it when i run mix deps.get Get this error when I go to http://localhost:4000/auth/github/new

UndefinedFunctionError at GET /auth/github/new

function Assent.Stategy.Github.authorize_url/1 is undefined (module Assent.Stategy.Github is not available)

UndefinedFunctionError at GET /auth/github/new

Exception:

** (UndefinedFunctionError) function Assent.Stategy.Github.authorize_url/1 is undefined (module Assent.Stategy.Github is not available)
    Assent.Stategy.Github.authorize_url([redirect_uri: "http://localhost:4000/auth/github/callback", client_id: "54d815f1ef420db0ae51", client_secret: "6d1fef230da224fd3da0aa0d5143c4cdbc4eae6e"])
    (pow_assent 0.4.17) lib/pow_assent/plug.ex:39: PowAssent.Plug.authorize_url/3
    (pow 1.0.30) lib/pow/phoenix/controllers/controller.ex:87: Pow.Phoenix.Controller.action/3
    (pow_assent 0.4.17) lib/pow_assent/phoenix/controllers/authorization_controller.ex:1: PowAssent.Phoenix.AuthorizationController.action/2
    (pow_assent 0.4.17) lib/pow_assent/phoenix/controllers/authorization_controller.ex:1: PowAssent.Phoenix.AuthorizationController.phoenix_controller_pipeline/2
    (phoenix 1.7.2) lib/phoenix/router.ex:430: Phoenix.Router.__call__/5
    (pointer 0.1.0) lib/pointer_web/endpoint.ex:1: PointerWeb.Endpoint.plug_builder_call/2
    (pointer 0.1.0) deps/plug/lib/plug/debugger.ex:136: PointerWeb.Endpoint."call (overridable 3)"/2
    (pointer 0.1.0) lib/pointer_web/endpoint.ex:1: PointerWeb.Endpoint.call/2
    (phoenix 1.7.2) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
    (plug_cowboy 2.6.1) lib/plug/cowboy/handler.ex:11: Plug.Cowboy.Handler.init/2
    (cowboy 2.10.0) c:/Software/Elixir/pointer/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2
    (cowboy 2.10.0) c:/Software/Elixir/pointer/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3
    (cowboy 2.10.0) c:/Software/Elixir/pointer/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3
    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

Code:

nofile

No code available.

Called with 1 arguments

lib/pow_assent/plug.ex

34     def authorize_url(conn, provider, redirect_uri) do
35       {strategy, provider_config} = get_provider_config(conn, provider, redirect_uri)
36   
37       provider_config
38       |> maybe_gen_nonce()
39>      |> strategy.authorize_url()
40       |> maybe_put_session_params(conn)
41     end
42   
43     defp maybe_gen_nonce(config) do
44       case Config.get(config, :nonce, nil) do
rajatksud commented 1 year ago

I had a typo in Assent.Strategy.Github