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

nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
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

Other popular topics Top

stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
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
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement