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

Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40165 209
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
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
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement