Harden web session handling and production config

This commit is contained in:
2026-04-07 19:48:48 -05:00
parent 890f3fff2b
commit 0292b2e85a
9 changed files with 96 additions and 20 deletions
+7
View File
@@ -267,6 +267,12 @@ const login = async ({ email, password }, context = {}) => {
};
const refresh = async (token) => {
if (!token) {
const err = new Error('Invalid or expired refresh token.');
err.statusCode = 401;
throw err;
}
const record = await authRepository.findRefreshToken(token);
if (!record) {
const err = new Error('Invalid or expired refresh token.');
@@ -293,6 +299,7 @@ const refresh = async (token) => {
};
const logout = async (token) => {
if (!token) return;
await authRepository.deleteRefreshToken(token);
};