fix(frontend): SuperOAuth flow — VITE_SUPEROAUTH_URL, redirect par provider, pas de client_id
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
# URL complète d'autorisation OAuth — SuperOAuth
|
# URL de base SuperOAuth — pas de client_id, SuperOAuth ne gère pas ce concept
|
||||||
# Format : https://superoauth.tetardtek.com/oauth/authorize?client_id=XXX&redirect_uri=http://localhost:5173/callback&response_type=token
|
# Le flow : /api/v1/auth/oauth/:provider?redirectUrl=<callback_url>
|
||||||
VITE_SUPEROAUTH_AUTHORIZE_URL=
|
# Valeur : voir brain/MYSECRETS section originsdigital
|
||||||
|
VITE_SUPEROAUTH_URL=
|
||||||
|
|||||||
@@ -8,7 +8,12 @@ interface HeaderProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default function Header({ theme, onToggleTheme, user }: 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 (
|
return (
|
||||||
<header className="border-b border-od-border bg-od-surface">
|
<header className="border-b border-od-border bg-od-surface">
|
||||||
|
|||||||
4
frontend/src/vite-env.d.ts
vendored
4
frontend/src/vite-env.d.ts
vendored
@@ -1,7 +1,9 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
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=<callback>
|
||||||
|
readonly VITE_SUPEROAUTH_URL: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImportMeta {
|
interface ImportMeta {
|
||||||
|
|||||||
Reference in New Issue
Block a user