From ae915babe642955045cfd17af69aed675d8ba28f Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Thu, 1 Feb 2024 21:36:46 +0800 Subject: [PATCH] :truck: Move oauth url --- pkg/server/startup.go | 4 ++-- pkg/server/well_known_api.go | 2 +- pkg/view/src/index.tsx | 4 ++-- pkg/view/src/pages/auth/connect.tsx | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/server/startup.go b/pkg/server/startup.go index 948117e..5fa34af 100644 --- a/pkg/server/startup.go +++ b/pkg/server/startup.go @@ -78,8 +78,8 @@ func NewServer() { api.Post("/auth/token", exchangeToken) api.Post("/auth/factors/:factorId", requestFactorToken) - api.Get("/auth/oauth/connect", auth, preConnect) - api.Post("/auth/oauth/connect", auth, doConnect) + api.Get("/auth/o/connect", auth, preConnect) + api.Post("/auth/o/connect", auth, doConnect) } A.Use("/", cache.New(cache.Config{ diff --git a/pkg/server/well_known_api.go b/pkg/server/well_known_api.go index 35e70df..cd9afa1 100644 --- a/pkg/server/well_known_api.go +++ b/pkg/server/well_known_api.go @@ -20,7 +20,7 @@ func getOidcConfiguration(c *fiber.Ctx) error { return c.JSON(fiber.Map{ "issuer": basepath, - "authorization_endpoint": fmt.Sprintf("%s/auth/oauth/connect", basepath), + "authorization_endpoint": fmt.Sprintf("%s/auth/o/connect", basepath), "token_endpoint": fmt.Sprintf("%s/api/auth/token", basepath), "userinfo_endpoint": fmt.Sprintf("%s/api/users/me", basepath), "response_types_supported": []string{"code", "token"}, diff --git a/pkg/view/src/index.tsx b/pkg/view/src/index.tsx index 39f65ad..c4af85c 100644 --- a/pkg/view/src/index.tsx +++ b/pkg/view/src/index.tsx @@ -23,8 +23,8 @@ render(() => ( import("./pages/personalise.tsx"))} /> import("./pages/auth/login.tsx"))} /> import("./pages/auth/register.tsx"))} /> - import("./pages/auth/connect.tsx"))} /> - import("./pages/auth/callback.tsx"))} /> + import("./pages/auth/connect.tsx"))} /> + import("./pages/auth/callback.tsx"))} /> import("./pages/users/confirm.tsx"))} /> diff --git a/pkg/view/src/pages/auth/connect.tsx b/pkg/view/src/pages/auth/connect.tsx index d5ffabe..0adf1cc 100644 --- a/pkg/view/src/pages/auth/connect.tsx +++ b/pkg/view/src/pages/auth/connect.tsx @@ -18,7 +18,7 @@ export default function OauthConnectPage() { const location = useLocation(); async function preConnect() { - const res = await fetch(`/api/auth/oauth/connect${location.search}`, { + const res = await fetch(`/api/auth/o/connect${location.search}`, { headers: { "Authorization": `Bearer ${getAtk()}` } }); @@ -51,7 +51,7 @@ export default function OauthConnectPage() { setLoading(true); setStatus("Approving..."); - const res = await fetch("/api/auth/oauth/connect?" + new URLSearchParams({ + const res = await fetch("/api/auth/o/connect?" + new URLSearchParams({ client_id: searchParams["client_id"] as string, redirect_uri: encodeURIComponent(searchParams["redirect_uri"] as string), response_type: "code",