thojanssens1
Ueberauth raises: function MyAppWeb.OAuthController.request/2 is undefined or private
Ueberauth raises the error below but I don’t see what is wrong with my code.
function MyAppWeb.OAuthController.request/2 is undefined or private
As far as I understand the request/2 controller action doesn’t need to be implemented as the ueberauth_google lib will redirect to Google sign on.
mix.exs:
defp deps do
[
{:ueberauth, "~> 0.10"},
{:ueberauth_google, "~> 0.10"},
# ...
]
end
config.exs:
config :ueberauth, Ueberauth.Strategy.Google.OAuth,
client_id: "xxx",
client_secret: "xxx"
config :ueberauth, Ueberauth,
providers: [
google: {Ueberauth.Strategy.Google, []}
]
router.ex:
scope "/" do
pipe_through :api
get "/:provider", MyAppWeb.OAuthController, :request
get "/:provider/callback", MyAppWeb.OAuthController, :callback
end
oauth_controller.ex:
defmodule MyAppWeb.OAuthController do
use MyAppWeb, :controller
plug Ueberauth
def callback(%{assigns: %{ueberauth_auth: ueberauth_data}} = conn, _params) do
# ...
end
def callback(%{assigns: %{ueberauth_failure: _}} = conn, _params) do
# ...
end
end
Execute:
GET http://localhost:4000/google
Result
UndefinedFunctionError at GET /google
function MyAppWeb.OAuthController.request/2 is undefined or private
Marked As Solved
thojanssens1
I finally found the error, I had to configure the :base_path option according to my routes. By default, the :base_path is assumed to be /auth.
I think this option should be forced to be explicitly set.
1
Popular in Questions
can someone please explain to me how Enum.reduce works with maps
New
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
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set?
Thanks.
New
I am trying to implement my new.html.eex file to create new posts on my website.
new.html.eex:
<h1>Create Post</h1>
<%= ...
New
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
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
Hey,
Just curious what are the main benefits of Elixir compared to Clojure?
When is Elixir more useful than Clojure and vice versa?
Th...
New
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
I have a super simple question about elixir - how would I take a file like this
foo
bar
baz
and output a new file that enumerates th...
New
Lets say I have map like this fetching from my database
%{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
Other popular topics
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
Hi there,
I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Hi everyone!
I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
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
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








