fix: await async generateToken in auth service
- Add await to all generateToken() calls - Fixes empty token issue in login/register responses - Token now properly includes user role for admin access
This commit is contained in:
8
apps/api/dist/auth/auth.service.js
vendored
8
apps/api/dist/auth/auth.service.js
vendored
@@ -80,7 +80,7 @@ let AuthService = class AuthService {
|
||||
emailVerified: false,
|
||||
},
|
||||
});
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
return {
|
||||
user: {
|
||||
id: user.id,
|
||||
@@ -142,7 +142,7 @@ let AuthService = class AuthService {
|
||||
tempToken: this.generateTempToken(user.id, user.email),
|
||||
};
|
||||
}
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
return {
|
||||
user: {
|
||||
id: user.id,
|
||||
@@ -246,7 +246,7 @@ let AuthService = class AuthService {
|
||||
tempToken: this.generateTempToken(user.id, user.email),
|
||||
};
|
||||
}
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
return {
|
||||
user: {
|
||||
id: user.id,
|
||||
@@ -305,7 +305,7 @@ let AuthService = class AuthService {
|
||||
throw new common_1.UnauthorizedException('Invalid TOTP code');
|
||||
}
|
||||
}
|
||||
const token = this.generateToken(userId, email);
|
||||
const token = await this.generateToken(userId, email);
|
||||
return {
|
||||
user: {
|
||||
id: user.id,
|
||||
|
||||
Reference in New Issue
Block a user