Skip to content

Build your personal knowledge base with Trilium Notes

return 401 when auth request is out of sync, closes #1056

zadam6b359b779608
diff --git a/src/routes/api/login.js b/src/routes/api/login.js
index 6bca0212a2..2bd88efec4 100644
--- a/src/routes/api/login.js
+++ b/src/routes/api/login.js
@@ -16,7 +16,7 @@ const ApiToken = require('../../entities/api_token');
async function loginSync(req) {
if (!await sqlInit.schemaExists()) {
- return [400, { message: "DB schema does not exist, can't sync." }];
+ return [500, { message: "DB schema does not exist, can't sync." }];
}
const timestampStr = req.body.timestamp;
@@ -27,7 +27,7 @@ async function loginSync(req) {
// login token is valid for 5 minutes
if (Math.abs(timestamp.getTime() - now.getTime()) > 5 * 60 * 1000) {
- return [400, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }];
+ return [401, { message: 'Auth request time is out of sync, please check that both client and server have correct time.' }];
}
const syncVersion = req.body.syncVersion;
@@ -102,4 +102,4 @@ module.exports = {
loginSync,
loginToProtectedSession,
token
-};
\ No newline at end of file
+};