Skip to content

Commit

Permalink
Merge pull request #423 from internxt/fix/sign-token-on-user-refresh
Browse files Browse the repository at this point in the history
[_]: Fix/Sign token using email
  • Loading branch information
larry-internxt authored Jan 30, 2024
2 parents a2b00c5 + f7f6be2 commit 111a333
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/app/middleware/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const passportAuth = passport.authenticate('jwt', { session: false });
function Sign(data, secret, expires = false) {
const token = expires ?
jwt.sign({ email: data, iat: getDefaultIAT() }, secret, { expiresIn: '14d' }) :
jwt.sign(Object.assign(data, { iat: getDefaultIAT() }), secret);
jwt.sign({ email: data, iat: getDefaultIAT() }, secret);
return token;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/e2e-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ describe('E2E TEST', () => {

userId = user.dataValues.id;
rootFolderId = user.dataValues.root_folder_id;
token = Sign({ email }, server.config.get('secrets').JWT);
token = Sign(email, server.config.get('secrets').JWT);
} catch (err: any) {
// eslint-disable-next-line no-console
console.error('Error setting up storage e2e tests: %s', err.message);
Expand Down Expand Up @@ -943,7 +943,7 @@ describe('E2E TEST', () => {

userId = user.dataValues.id;
rootFolderId = user.dataValues.root_folder_id;
token = Sign({ email }, server.config.get('secrets').JWT);
token = Sign(email, server.config.get('secrets').JWT);
} catch (err: any) {
// eslint-disable-next-line no-console
console.error('Error setting up storage e2e tests: %s', err.message);
Expand Down

0 comments on commit 111a333

Please sign in to comment.