Description
The application currently has authentication functionality with login and register features, but lacks a proper logout endpoint on the backend and a logout button in the dashboard UI. While the frontend has logout logic implemented in the auth context, we need:
- A backend logout endpoint following the project's hexagonal architecture
- A logout button in the dashboard header (top-right position) for easy access
Current State
- ✅ Frontend logout logic exists in
useAuthContext.tsx
- ✅ Frontend auth service has logout function calling
/api/v1/auth/logout
- ❌ Backend
/api/v1/auth/logout endpoint is missing
- ❌ Dashboard lacks visible logout button
Requirements
Backend
- Add
POST /api/v1/auth/logout endpoint in /backend/src/infrastructure/web/routers/users.py
- Follow hexagonal architecture patterns (use case → domain → infrastructure)
- Handle token invalidation/blacklisting if needed
- Return appropriate HTTP status codes
Frontend
- Add logout button to dashboard header (
/frontend/src/pages/home.page.tsx)
- Position button in top-right corner of the header
- Use existing
useAuthContext hook for logout functionality
- Ensure logout redirects to login page
- Follow project's feature-based architecture and UI conventions
Acceptance Criteria
Technical Notes
Backend Implementation
- Location:
/backend/src/infrastructure/web/routers/users.py
- Should be added near existing auth endpoints (register, login)
- Consider if token blacklisting is needed for security
- Follow existing dependency injection patterns
Frontend Implementation
- Location:
/frontend/src/pages/home.page.tsx header section
- Use existing
useAuthContext hook: const { logout } = useAuthContext()
- Style with TailwindCSS to match existing UI components
- Consider adding user email/avatar next to logout button
Priority
Medium - Important for user experience and security best practices
Description
The application currently has authentication functionality with login and register features, but lacks a proper logout endpoint on the backend and a logout button in the dashboard UI. While the frontend has logout logic implemented in the auth context, we need:
Current State
useAuthContext.tsx/api/v1/auth/logout/api/v1/auth/logoutendpoint is missingRequirements
Backend
POST /api/v1/auth/logoutendpoint in/backend/src/infrastructure/web/routers/users.pyFrontend
/frontend/src/pages/home.page.tsx)useAuthContexthook for logout functionalityAcceptance Criteria
POST /api/v1/auth/logoutis implemented/loginTechnical Notes
Backend Implementation
/backend/src/infrastructure/web/routers/users.pyFrontend Implementation
/frontend/src/pages/home.page.tsxheader sectionuseAuthContexthook:const { logout } = useAuthContext()Priority
Medium - Important for user experience and security best practices