Comments (2)
Howdy @wess, given that your second router is V1.Routes.Auth
should your first forward to be forward("/v1", to: V1.Routes)
instead of just V1
?
Do you have a sample project I could peek at?
from ueberauth.
here's all the codes:
API Router:
defmodule Api do
require Logger
use Responses
use Plug.Router
plug(Plug.Logger)
plug(
Plug.Static,
at: "/public",
from: "public"
)
plug(:match)
plug(:dispatch)
forward("/v1", to: V1)
get "/" do
conn
|> send_file(:ok, "public/index.html")
end
match _ do
conn
|> json(404, %{error: "not found"})
end
end
V1 ROUTER
defmodule V1 do
use Router
plug(Plug.Logger)
plug(:match)
plug(:dispatch)
forward("/user", to: V1.Routes.User)
forward("/auth", to: V1.Routes.Auth)
match _ do
conn
|> json(404, %{error: "Not found"})
end
end
AUTH ROUTER:
defmodule V1.Routes.Auth do
use Plug.Router
require Logger
plug(:match)
plug(:fetch_query_params)
plug(Ueberauth)
plug(:dispatch)
get "/:provider/callback" do
conn
|> send_resp(200, %{success: "facebook"})
end
match _ do
conn
|> send_resp(404, %{error: "Not found"})
end
end
from ueberauth.
Related Issues (20)
- OAuth2 needs new maintainers HOT 4
- State nonce cookie should properly be signed HOT 2
- How can run Ueberauth plug directly? HOT 3
- Custom `callback_port` and `callback_scheme` not used HOT 1
- Callback URL not mounted right when router has nested paths
- Can't set strategy options at runtime HOT 2
- Line Login v2.1 update request which I've done HOT 4
- Gracefully handle unknown providers HOT 10
- callback_port config compiled into plug at compile time HOT 10
- App.Auth.AuthController.request/2 is undefined or private HOT 1
- minor: mix package versions are out of date
- New hex.pm release? HOT 1
- Incorrect callback_url when using Bandit.PhoenixAdapter
- put_session successful, but get_session failed HOT 1
- function MyAppWeb.OAuthController.request/2 is undefined or private HOT 1
- Support for nonces HOT 1
- FR: Support multiple usages of the same strategy in config HOT 13
- Incomplete docs to configure pipeline and check that user is authenticated HOT 3
- Latest release breaks existing paths HOT 6
- Latest version is retired HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ueberauth.