Checkpoint: Implémentation de la cohabitation des deux systèmes d'authentification (OAuth Manus et authentification locale). Les utilisateurs peuvent maintenant choisir entre :
- Authentification locale avec email/mot de passe - OAuth Manus pour les utilisateurs de la plateforme Le contexte tRPC gère automatiquement les deux types de tokens (JWT local et JWT OAuth).
This commit is contained in:
@@ -6,3 +6,13 @@ export const APP_LOGO = "https://placehold.co/128x128/E1E7EF/1F2937?text=App";
|
||||
|
||||
// Retourne l'URL de la page de connexion locale
|
||||
export const getLoginUrl = () => "/login";
|
||||
|
||||
// Retourne l'URL de connexion OAuth Manus
|
||||
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;
|
||||
const redirectUri = `${window.location.origin}/api/oauth/callback`;
|
||||
const state = btoa(currentUrl);
|
||||
return `${portalUrl}?appId=${appId}&redirectUri=${encodeURIComponent(redirectUri)}&state=${encodeURIComponent(state)}&responseType=code`;
|
||||
};
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Input } from "@/components/ui/input";
|
||||
import { Label } from "@/components/ui/label";
|
||||
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||
import { APP_LOGO, APP_TITLE } from "@/const";
|
||||
import { APP_LOGO, APP_TITLE, getOAuthLoginUrl } from "@/const";
|
||||
import { Loader2 } from "lucide-react";
|
||||
|
||||
export default function Login() {
|
||||
@@ -102,6 +102,26 @@ export default function Login() {
|
||||
Se connecter
|
||||
</Button>
|
||||
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 flex items-center">
|
||||
<span className="w-full border-t" />
|
||||
</div>
|
||||
<div className="relative flex justify-center text-xs uppercase">
|
||||
<span className="bg-background px-2 text-muted-foreground">
|
||||
Ou
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
className="w-full"
|
||||
onClick={() => window.location.href = getOAuthLoginUrl()}
|
||||
>
|
||||
Se connecter avec Manus OAuth
|
||||
</Button>
|
||||
|
||||
<div className="text-sm text-center text-muted-foreground">
|
||||
Pas encore de compte ?{" "}
|
||||
<button
|
||||
|
||||
Reference in New Issue
Block a user