Skip to content

Commit 84ba7cc

Browse files
committed
Add username to token
1 parent 5c092ef commit 84ba7cc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backend/user-service/services/tokenService.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { UnauthorisedError } from "../utils/httpErrors.js";
77
class TokenService {
88
static generateAccessToken(user) {
99
const accessToken = jwt.sign(
10-
{ id: user.id, isAdmin: user.isAdmin },
10+
{ id: user.id, isAdmin: user.isAdmin, username: user.username },
1111
jwtConfig.accessTokenSecret,
1212
jwtConfig.accessTokenOptions
1313
);
@@ -16,7 +16,7 @@ class TokenService {
1616

1717
static generateRefreshToken(user) {
1818
const refreshToken = jwt.sign(
19-
{ id: user.id, jti: uuidv4() },
19+
{ id: user.id, jti: uuidv4(), username: user.username },
2020
jwtConfig.refreshTokenSecret,
2121
jwtConfig.refreshTokenOptions
2222
);

0 commit comments

Comments
 (0)