Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
🔧 Only send ID in post-login token
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Aug 4, 2020
1 parent 128d995 commit f883ec6
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/_staart/helpers/jwt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ export const passwordResetToken = (id: number) =>
/**
* Generate a new login JWT
*/
export const loginToken = (user: users) =>
generateToken(user, TOKEN_EXPIRY_LOGIN, Tokens.LOGIN);
export const loginToken = (id: number) =>
generateToken({ id }, TOKEN_EXPIRY_LOGIN, Tokens.LOGIN);

/**
* Generate a new login link JWT
Expand Down Expand Up @@ -218,10 +218,7 @@ export const postLoginTokens = async (
await updateSessionByJwt(user.id, refreshTokenString, {});
}
return {
token: await loginToken({
...deleteSensitiveInfoUser(user),
// email: (await getUserBestEmail(user.id)).email
}),
token: await loginToken(user.id),
refresh: !refreshTokenString ? refresh : undefined,
};
};
Expand Down

0 comments on commit f883ec6

Please sign in to comment.