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:
BIN
apps/.DS_Store
vendored
BIN
apps/.DS_Store
vendored
Binary file not shown.
BIN
apps/api/.DS_Store
vendored
BIN
apps/api/.DS_Store
vendored
Binary file not shown.
6
apps/api/dist/auth/auth.controller.d.ts
vendored
6
apps/api/dist/auth/auth.controller.d.ts
vendored
@@ -21,7 +21,7 @@ export declare class AuthController {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
}>;
|
||||
login(body: {
|
||||
email: string;
|
||||
@@ -44,7 +44,7 @@ export declare class AuthController {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
requiresOtp?: undefined;
|
||||
availableMethods?: undefined;
|
||||
tempToken?: undefined;
|
||||
@@ -61,7 +61,7 @@ export declare class AuthController {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
}>;
|
||||
googleAuth(): Promise<void>;
|
||||
googleAuthCallback(req: any, res: Response): Promise<void>;
|
||||
|
||||
8
apps/api/dist/auth/auth.service.d.ts
vendored
8
apps/api/dist/auth/auth.service.d.ts
vendored
@@ -14,7 +14,7 @@ export declare class AuthService {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
}>;
|
||||
login(email: string, password: string): Promise<{
|
||||
requiresOtp: boolean;
|
||||
@@ -34,7 +34,7 @@ export declare class AuthService {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
requiresOtp?: undefined;
|
||||
availableMethods?: undefined;
|
||||
tempToken?: undefined;
|
||||
@@ -62,7 +62,7 @@ export declare class AuthService {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
requiresOtp?: undefined;
|
||||
availableMethods?: undefined;
|
||||
tempToken?: undefined;
|
||||
@@ -75,7 +75,7 @@ export declare class AuthService {
|
||||
avatarUrl: string | null;
|
||||
emailVerified: boolean;
|
||||
};
|
||||
token: Promise<string>;
|
||||
token: string;
|
||||
}>;
|
||||
private generateToken;
|
||||
private generateTempToken;
|
||||
|
||||
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,
|
||||
|
||||
2
apps/api/dist/auth/auth.service.js.map
vendored
2
apps/api/dist/auth/auth.service.js.map
vendored
File diff suppressed because one or more lines are too long
2
apps/api/dist/tsconfig.build.tsbuildinfo
vendored
2
apps/api/dist/tsconfig.build.tsbuildinfo
vendored
File diff suppressed because one or more lines are too long
BIN
apps/api/src/.DS_Store
vendored
Normal file
BIN
apps/api/src/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -44,7 +44,7 @@ export class AuthService {
|
||||
});
|
||||
|
||||
// Generate JWT token
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
|
||||
return {
|
||||
user: {
|
||||
@@ -123,7 +123,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
// Generate full JWT token
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
|
||||
return {
|
||||
user: {
|
||||
@@ -259,7 +259,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
// Generate JWT token
|
||||
const token = this.generateToken(user.id, user.email);
|
||||
const token = await this.generateToken(user.id, user.email);
|
||||
|
||||
return {
|
||||
user: {
|
||||
@@ -345,7 +345,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
// Generate full JWT token
|
||||
const token = this.generateToken(userId, email);
|
||||
const token = await this.generateToken(userId, email);
|
||||
|
||||
return {
|
||||
user: {
|
||||
|
||||
Reference in New Issue
Block a user