🚚 Move oauth url

This commit is contained in:
LittleSheep 2024-02-01 21:36:46 +08:00
parent dbc09bd7af
commit ae915babe6
4 changed files with 7 additions and 7 deletions

View File

@ -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{

View File

@ -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"},

View File

@ -23,8 +23,8 @@ render(() => (
<Route path="/personalise" component={lazy(() => import("./pages/personalise.tsx"))} />
<Route path="/auth/login" component={lazy(() => import("./pages/auth/login.tsx"))} />
<Route path="/auth/register" component={lazy(() => import("./pages/auth/register.tsx"))} />
<Route path="/auth/oauth/connect" component={lazy(() => import("./pages/auth/connect.tsx"))} />
<Route path="/auth/oauth/callback" component={lazy(() => import("./pages/auth/callback.tsx"))} />
<Route path="/auth/o/connect" component={lazy(() => import("./pages/auth/connect.tsx"))} />
<Route path="/auth/o/callback" component={lazy(() => import("./pages/auth/callback.tsx"))} />
<Route path="/users/me/confirm" component={lazy(() => import("./pages/users/confirm.tsx"))} />
</Router>
</UserinfoProvider>

View File

@ -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",