curl -X POST "https://api.chronos.app/auth/logout" \
-H "Accept: application/json" \
-b "__Host-session=eyJhbG...; __Host-refresh=eyJhbG..."
{
"message": "Logged out"
}
Logs out the user by clearing all session cookies. Does not revoke tokens on the server.
curl -X POST "https://api.chronos.app/auth/logout" \
-H "Accept: application/json" \
-b "__Host-session=eyJhbG...; __Host-refresh=eyJhbG..."
{
"message": "Logged out"
}
curl -X POST "https://api.chronos.app/auth/logout" \
-H "Accept: application/json" \
-b "__Host-session=eyJhbG...; __Host-refresh=eyJhbG..."
{
"message": "Logged out"
}
SESSION_COOKIE_NAME config) is cleared by setting its value to empty and max-age to 0REFRESH_COOKIE_NAME config) is cleared by setting its value to empty and max-age to 0CSRF_COOKIE_NAME config) is clearedRATE_LIMIT_AUTH configuration. The rate limiter uses the client’s IP address as the key.
max-age=0 to immediately expire the cookieasync function logout() {
try {
const response = await fetch('/auth/logout', {
method: 'POST',
credentials: 'include'
});
if (response.ok) {
// Clear any client-side state
localStorage.removeItem('user');
// Redirect to login page
window.location.href = '/login';
}
} catch (error) {
console.error('Logout error:', error);
// Even on error, redirect to login for safety
window.location.href = '/login';
}
}
Clear Local Storage
localStorage.clear();
// or selectively:
localStorage.removeItem('user');
localStorage.removeItem('preferences');
Reset Application State
// Redux example
store.dispatch({ type: 'RESET' });
backend/app/routers/auth.py:265-272