feat(frontend): Implement HttpOnly cookie authentication and API v1 integration. Update AuthService for cookie-based session management, configure Axios with v1 prefix and credentials, and enhance OIDC callback logic.

This commit is contained in:
Yunxiao Xu
2026-02-12 01:33:32 -08:00
parent 2545f6df13
commit dcfc090f1c
5 changed files with 52 additions and 165 deletions

View File

@@ -5,6 +5,7 @@ import { LoginForm } from "./components/auth/LoginForm"
import { RegisterForm } from "./components/auth/RegisterForm"
import { AuthCallback } from "./components/auth/AuthCallback"
import { AuthService, type UserResponse } from "./services/auth"
import { registerUnauthorizedCallback } from "./services/api"
function App() {
const [isAuthenticated, setIsAuthenticated] = useState(false)
@@ -13,6 +14,12 @@ function App() {
const [isLoading, setIsLoading] = useState(true)
useEffect(() => {
// Register callback to handle session expiration from anywhere in the app
registerUnauthorizedCallback(() => {
setIsAuthenticated(false)
setUser(null)
})
const initAuth = async () => {
try {
const userData = await AuthService.getMe()