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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user