psantos

psantos

Function BlogWeb.AuthController.request/2 is undefined or private

Hi there

I am trying to setup ueberauth with github as the provider.

I added both dependencies:

{:ueberauth, "~> 0.6.3"},
{:ueberauth_github, "~> 0.8.0"}

Also added them as extra_applications:

def application do
    [
      mod: {Blog.Application, []},
      extra_applications: [:logger, :runtime_tools, :os_mon, :ueberauth, :ueberauth_github]
    ]
end

on config/config.exs, at the bottom, I added:

config :ueberauth, Ueberauth,
  providers: [
    githuib: {Ueberauth.Strategy.Github, []}
  ]

config :ueberauth, Ueberauth.Strategy.Github.OAuth,
  client_id: "xxxxx",
  client_secret: "xxxxx"

Add these changes to my router.ex

scope "/auth", BlogWeb do
    pipe_through(:browser)

    get "/:provider", AuthController, :request
    get "/:provider/callback", AuthController, :callback
  end

And I created a controller (auth_controller.ex):

defmodule BlogWeb.AuthController do
  use BlogWeb, :controller

  plug(Ueberauth)

  def callback(conn, params) do
       # ....
  end
end

But when I try to visit http://localhost:4000/auth/github, instead being redirected to github page, this error appears:

UndefinedFunctionError at GET /auth/github
function BlogWeb.AuthController.request/2 is undefined or private

I tried everything. I looked into other projects on github using the same versions, and the code are the same. I try to delete the deps folder and installed all deps again and recompile. But still no luck. The same error.

I am using Elixir 1.11.3
Phoenix 1.5.8

Marked As Solved

michallepicki

michallepicki

If you copied it correctly, you may have a typo in the config:

    githuib: {Ueberauth.Strategy.Github, []}

githuib should probably be github

Also Liked

psantos

psantos

Don’t believe :joy: I spent more than a hour trying to figure out what was wrong :smile:

Thank you very much

Last Post!

michallepicki

michallepicki

happens to everybody!

Where Next?

Popular in Questions Top

New
Emily
I have VueJS GUIs with the project generated using Webpack. I have Elixir modules that will need to be used by the VueJS GUIs. I forese...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New