From f471d62d41a9fc6296432b35ed8d018b0370cddf Mon Sep 17 00:00:00 2001 From: vicent Date: Thu, 25 May 2023 10:09:38 +0200 Subject: [PATCH] refs #5554 refactor: 'renewToken' utiliza logout y createAccessToken --- back/methods/vn-user/renew-token.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/back/methods/vn-user/renew-token.js b/back/methods/vn-user/renew-token.js index 6275214f1..c7214453d 100644 --- a/back/methods/vn-user/renew-token.js +++ b/back/methods/vn-user/renew-token.js @@ -33,8 +33,9 @@ module.exports = Self => { return response; } - const accessToken = await models.AccessToken.create({userId: userId}); - await models.AccessToken.destroyById(tokenId); + await Self.logout(tokenId); + const user = await Self.findById(userId); + const accessToken = await user.createAccessToken(); return {token: accessToken.id, created: accessToken.created}; };