Checkpoint: Correction de la redirection OAuth pour revenir à l'application après authentification. Le callback OAuth décode maintenant le state pour rediriger vers /admin au lieu de rester sur le tableau de bord Manus. Le système gère maintenant correctement les deux modes d'authentification (local + OAuth).

This commit is contained in:
Manus Sandbox
2025-11-19 08:24:59 -05:00
parent 42826fc7dd
commit 4d2ed3d5d8
3 changed files with 24 additions and 3 deletions

View File

@@ -11,8 +11,9 @@ export const getLoginUrl = () => "/login";
export const getOAuthLoginUrl = () => {
const appId = import.meta.env.VITE_APP_ID;
const portalUrl = import.meta.env.VITE_OAUTH_PORTAL_URL;
const currentUrl = window.location.href;
// Toujours rediriger vers /admin après OAuth
const redirectAfterAuth = `${window.location.origin}/admin`;
const redirectUri = `${window.location.origin}/api/oauth/callback`;
const state = btoa(currentUrl);
const state = btoa(redirectAfterAuth);
return `${portalUrl}?appId=${appId}&redirectUri=${encodeURIComponent(redirectUri)}&state=${encodeURIComponent(state)}&responseType=code`;
};