diff --git a/lib/extensions/index.js b/lib/extensions/index.js index 86ac086..d07c8fc 100644 --- a/lib/extensions/index.js +++ b/lib/extensions/index.js @@ -364,11 +364,12 @@ Accounts.link = function (req) { Accounts.getOrCreate = function (req) { var id = Accounts._getTokenId(req.auth); - var idNode = { type: 'ppid', name: id }; + var idNode = { createdAt: new Date().toISOString(), type: 'ppid', name: id }; return DB.accounts.get(idNode).then(function (acc) { if (acc) { return acc; } - acc = { id: id, sub: req.auth.sub, iss: req.auth.iss, domains: [], ports: [], nodes: [ idNode ] }; + acc = { createdAt: idNode.createdAt, id: id, sub: req.auth.sub, iss: req.auth.iss, + domains: [], ports: [], nodes: [ idNode ] }; return DB.accounts.add(acc).then(function () { // intentionally not returned to the promise chain DB.save().catch(function (err) {