save data better

This commit is contained in:
AJ ONeal 2018-06-08 08:25:06 +00:00
parent 08833123b2
commit 34b86bc7a3
1 changed files with 6 additions and 0 deletions

View File

@ -86,6 +86,12 @@ module.exports.authenticate = function (opts) {
};
tokenData.jwt = jwt.sign(tokenData, state.secret);
resolve(tokenData);
fs.writeFile(path.join(__dirname, 'emails', auth.subject + '.data'), JSON.stringify(tokenData), function (err) {
if (err) {
console.error('[ERROR] in writing token details');
console.error(err);
}
});
return tokenData;
}