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
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
Don’t believe
I spent more than a hour trying to figure out what was wrong ![]()
Thank you very much
Last Post!
michallepicki
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









