feat: include user role in JWT payload
- Updated `request.interface.ts` to add `role` to the user object. - Modified `auth.service.ts` to include `role` in the JWT payload.
This commit is contained in:
@@ -136,6 +136,7 @@ export class AuthService {
|
||||
const accessToken = await this.jwtService.generateJwt({
|
||||
sub: user.uuid,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
});
|
||||
|
||||
const session = await this.sessionsService.createSession(
|
||||
@@ -178,6 +179,7 @@ export class AuthService {
|
||||
const accessToken = await this.jwtService.generateJwt({
|
||||
sub: user.uuid,
|
||||
username: user.username,
|
||||
role: user.role,
|
||||
});
|
||||
|
||||
const session = await this.sessionsService.createSession(
|
||||
|
||||
@@ -4,5 +4,6 @@ export interface AuthenticatedRequest extends Request {
|
||||
user: {
|
||||
sub: string;
|
||||
username: string;
|
||||
role: string;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user