Can't add link to 'Sign in with Github' using pow_assent

I have pow set up for email/password authorization in Phoenix 1.6. I added pow_assent to use Github as a provider. The problem is after adding the necessary config information, in router.ex, I added the new scope:

scope "/" do
    pipe_through :skip_csrf_protection


and the new pipeline:

pipeline :skip_csrf_protection do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_live_flash
    plug :put_root_layout, {BlogTestWeb.LayoutView, :root}
    plug :put_secure_browser_headers

When I check for new routes with mix phx.routes, only 1 route is shown, the POST route.
pow_assent_post_authorization_path POST /auth/:provider/callback PowAssent.Phoenix.AuthorizationController :callback
No other pow_assent routes are shown on the list.
After adding the link to the templates:

<%= for link <- PowAssent.Phoenix.ViewHelpers.provider_links(@conn),
  do: content_tag(:span, link) %>

When I click on the Register link, the “Sign in with Github” is not shown on the page.
Is there an issue with pow_assent and Phoenix 1.6? The information I’ve found all uses earlier versions of Phoenix in the examples. I watched the YouTube video along with reading the docs.

1 Like

Setting up Providers - you should be adding the following config to your config.exs

config :my_app, :pow_assent,
  providers: [
    github: [
      client_id: "REPLACE_WITH_CLIENT_ID",
      client_secret: "REPLACE_WITH_CLIENT_SECRET",
      strategy: Assent.Strategy.Github

PowAssent.Phoenix.ViewHelpers.provider_links is reading list of providers from config.

I found the problem. My config was fine. What I didn’t do, which wasn’t shown in the video, was add the line pow_assent_routes() to the appropriate scope in router.ex, as explained in the pow_assent file.

Now the link appears and I am redirect to Github as expected.