forked from baron/baron-sso
feat: SSO 로그인 리다이렉션 흐름 구현 (userfront & adminfront 연동) #243
This commit is contained in:
34
adminfront/src/features/auth/AuthCallbackPage.tsx
Normal file
34
adminfront/src/features/auth/AuthCallbackPage.tsx
Normal file
@@ -0,0 +1,34 @@
|
||||
import { useEffect } from "react";
|
||||
import { useNavigate, useSearchParams } from "react-router-dom";
|
||||
import { ShieldHalf } from "lucide-react";
|
||||
|
||||
function AuthCallbackPage() {
|
||||
const navigate = useNavigate();
|
||||
const [searchParams] = useSearchParams();
|
||||
|
||||
useEffect(() => {
|
||||
const token = searchParams.get("token");
|
||||
if (token) {
|
||||
window.localStorage.setItem("admin_session", token);
|
||||
// Redirect to home after a short delay or immediately
|
||||
navigate("/", { replace: true });
|
||||
} else {
|
||||
console.error("No token found in callback URL");
|
||||
navigate("/login", { replace: true });
|
||||
}
|
||||
}, [navigate, searchParams]);
|
||||
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center bg-background">
|
||||
<div className="flex flex-col items-center gap-4">
|
||||
<div className="flex h-16 w-16 items-center justify-center rounded-2xl bg-primary/15 text-primary shadow-lg animate-pulse">
|
||||
<ShieldHalf size={32} />
|
||||
</div>
|
||||
<div className="text-lg font-semibold">인증 완료 중...</div>
|
||||
<p className="text-sm text-muted-foreground">세션을 동기화하고 있습니다.</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default AuthCallbackPage;
|
||||
Reference in New Issue
Block a user