From 75aad8968fcab9a12b1c108c5671aca894a7a6e8 Mon Sep 17 00:00:00 2001 From: Tetardtek Date: Sat, 14 Mar 2026 07:39:51 +0100 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20SuperOAuth=20flow=20=E2=80=94?= =?UTF-8?q?=20VITE=5FSUPEROAUTH=5FURL,=20redirect=20par=20provider,=20pas?= =?UTF-8?q?=20de=20client=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/.env.example | 7 ++++--- frontend/src/components/layout/Header.tsx | 7 ++++++- frontend/src/vite-env.d.ts | 4 +++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/frontend/.env.example b/frontend/.env.example index 864771f..5218608 100644 --- a/frontend/.env.example +++ b/frontend/.env.example @@ -1,3 +1,4 @@ -# URL complète d'autorisation OAuth — SuperOAuth -# Format : https://superoauth.tetardtek.com/oauth/authorize?client_id=XXX&redirect_uri=http://localhost:5173/callback&response_type=token -VITE_SUPEROAUTH_AUTHORIZE_URL= +# URL de base SuperOAuth — pas de client_id, SuperOAuth ne gère pas ce concept +# Le flow : /api/v1/auth/oauth/:provider?redirectUrl= +# Valeur : voir brain/MYSECRETS section originsdigital +VITE_SUPEROAUTH_URL= diff --git a/frontend/src/components/layout/Header.tsx b/frontend/src/components/layout/Header.tsx index b927af3..71ad8ea 100644 --- a/frontend/src/components/layout/Header.tsx +++ b/frontend/src/components/layout/Header.tsx @@ -8,7 +8,12 @@ interface HeaderProps { } export default function Header({ theme, onToggleTheme, user }: HeaderProps) { - const loginUrl = import.meta.env.VITE_SUPEROAUTH_AUTHORIZE_URL; + const callbackUrl = encodeURIComponent( + `${window.location.origin}/callback` + ); + // Redirige vers SuperOAuth — l'utilisateur choisit son provider (Discord, GitHub, Google, Twitch) + // SuperOAuth redirige ensuite vers /callback?token=JWT&refresh=... + const loginUrl = `${import.meta.env.VITE_SUPEROAUTH_URL}/api/v1/auth/oauth/discord?redirectUrl=${callbackUrl}`; return (
diff --git a/frontend/src/vite-env.d.ts b/frontend/src/vite-env.d.ts index 9c44384..5f487a1 100644 --- a/frontend/src/vite-env.d.ts +++ b/frontend/src/vite-env.d.ts @@ -1,7 +1,9 @@ /// interface ImportMetaEnv { - readonly VITE_SUPEROAUTH_AUTHORIZE_URL: string; + // URL de base SuperOAuth — ex: https://superoauth.tetardtek.com + // Flow login : VITE_SUPEROAUTH_URL + /api/v1/auth/oauth/:provider?redirectUrl= + readonly VITE_SUPEROAUTH_URL: string; } interface ImportMeta {