diff --git a/server/routing/client/api.js b/server/routing/client/api.js index d69bda45..60479c63 100644 --- a/server/routing/client/api.js +++ b/server/routing/client/api.js @@ -776,12 +776,12 @@ function checkOveruseApiToken(authorized, token_docs, res, callback) { res.status(429).send(JSON.stringify(error.tooMany)); return; } else { - db.collection("timeout_api").update({guid: token}, {$inc: {used: 1}}, function(e, d) { + db.collection("timeout_api").update({guid: token_docs[0].token}, {$inc: {used: 1}}, function(e, d) { callback(); }); } } else { - db.collection("timeout_api").insert({guid: token, used: 0, createdAt: new Date(), type: "ALL"}, function(e, d) { + db.collection("timeout_api").insert({guid: token_docs[0].token, used: 0, createdAt: new Date(), type: "ALL"}, function(e, d) { callback(); }); }