GET /auth/logout
Terminates the current user session and logs the user out of the vLife DGO system. Destroys all session data and redirects to the sign-in page.Request
No parameters required. This is a simple GET request.cURL
JavaScript
Session Handling
The endpoint checks the current session state:-
If logged in (
req.session.loggedin == true):- Calls
req.session.destroy()to remove all session data - Session cookie is invalidated
- User data cleared from memory
- Calls
-
If not logged in:
- No session to destroy
- Redirects to signin page anyway
Success Response
HTTP Status: 302 (Redirect) Location:/auth/signin
Session: Destroyed
Cookies: Session cookie invalidated
Session Data Cleared
The following session properties are destroyed:req.session.loggedin
Authentication flag - set to false/removed
req.session.name
Employee full name - cleared from memory
req.session.usrId
Employee ID - removed from session
Redirect Behavior
All logout requests redirect to
/auth/signin regardless of whether a session existed.- User requests
/auth/logout - Server destroys session (if exists)
- Server responds with 302 redirect
- Browser navigates to
/auth/signin
Example Usage
HTML Link:Security Notes
No CSRF protection is implemented on this endpoint as it performs a safe GET operation that only destroys the user’s own session.
Session Configuration
The application uses server-side sessions (likely express-session):- Session Store: Server-side (memory or database)
- Session Cookie:
connect.sid(default name) - Destruction: Complete removal via
req.session.destroy()
Error Handling
No explicit error handling is implemented. All requests redirect to/auth/signin:
- Session exists and destroyed → redirect
- No session exists → redirect
- Error during destroy → likely redirects anyway