curl --request GET \
--url https://api.example.com/api/auth/session{
"hasSession": true,
"expiresAt": 123
}Retrieve current session status and expiration time
curl --request GET \
--url https://api.example.com/api/auth/session{
"hasSession": true,
"expiresAt": 123
}Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Crocantefinancial/crocante-pitch-frontend/llms.txt
Use this file to discover all available pages before exploring further.
Cookie: crocante_session=<encrypted_session_value>
curl -X GET https://api.crocante.com/api/auth/session \
-H "Accept: application/json" \
-b cookies.txt
true if a valid session cookie with a decryptable token is present, false otherwisehasSession is true{
"hasSession": true,
"expiresAt": 1710252000000
}
{
"hasSession": false
}
expiresAt timestamp is calculated using:
expiresAt = sessionIssuedAt + sessionMaxAge
sessionIssuedAt: Timestamp when the session cookie was created (stored in encrypted cookie payload)sessionMaxAge: 300 seconds (5 minutes)Session issued at: 2026-03-12T10:00:00.000Z (1710237600000 ms)
Max age: 300 seconds (300000 ms)
Expires at: 2026-03-12T10:05:00.000Z (1710237900000 ms)
const checkSession = async () => {
const response = await fetch('/api/auth/session', {
credentials: 'include'
});
const { hasSession, expiresAt } = await response.json();
if (hasSession && expiresAt) {
const timeRemaining = expiresAt - Date.now();
const minutesRemaining = Math.floor(timeRemaining / 60000);
if (minutesRemaining <= 1) {
showExpiryWarning(minutesRemaining);
}
} else {
redirectToLogin();
}
};
setInterval(async () => {
const response = await fetch('/api/auth/session', {
credentials: 'include'
});
const { hasSession } = await response.json();
if (!hasSession) {
// Session expired, redirect to login
window.location.href = '/login';
}
}, 30000); // Check every 30 seconds
const ProtectedRoute = async () => {
const response = await fetch('/api/auth/session', {
credentials: 'include'
});
const { hasSession } = await response.json();
if (!hasSession) {
redirect('/login');
}
return <ProtectedContent />;
};
interface SessionPayload {
token: string; // Backend access token
issuedAt: number; // Timestamp in milliseconds
}
crocante_sessiontrue (JavaScript cannot access)true in production (HTTPS only)Strict (CSRF protection)/ (available site-wide)// Check current session status
const getSessionStatus = async () => {
const response = await fetch('/api/auth/session', {
credentials: 'include',
headers: {
'Accept': 'application/json'
}
});
const session = await response.json();
return session;
};
// Usage
const { hasSession, expiresAt } = await getSessionStatus();
if (hasSession) {
const expiresIn = Math.floor((expiresAt - Date.now()) / 1000);
console.log(`Session expires in ${expiresIn} seconds`);
} else {
console.log('No active session');
}
// React hook for session monitoring
import { useEffect, useState } from 'react';
function useSession() {
const [session, setSession] = useState({ hasSession: false });
useEffect(() => {
const checkSession = async () => {
const res = await fetch('/api/auth/session', {
credentials: 'include'
});
const data = await res.json();
setSession(data);
};
checkSession();
const interval = setInterval(checkSession, 30000);
return () => clearInterval(interval);
}, []);
return session;
}
issuedAt, not last access