Skip to content

Commit b95b65b

Browse files
committed
Merge branch 'develop'
2 parents 0b8d489 + d2b1fe6 commit b95b65b

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

apps/backend/src/auth/auth.service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,15 @@ export class AuthService {
9191
const payload = { sub: userId, email };
9292

9393
const accessToken = await this.jwtService.signAsync(payload, {
94-
secret: this.config.get('JWT_SECRET'),
95-
expiresIn: this.config.get('JWT_EXPIRES_IN'),
94+
secret: this.config.get<string>('JWT_SECRET') || 'default_secret',
95+
expiresIn: this.config.get<string>('JWT_EXPIRES_IN') || '15m',
9696
});
9797

9898
const refreshToken = await this.jwtService.signAsync(payload, {
99-
secret: this.config.get('JWT_REFRESH_SECRET'),
100-
expiresIn: this.config.get('JWT_REFRESH_EXPIRES_IN'),
99+
secret:
100+
this.config.get<string>('JWT_REFRESH_SECRET') ||
101+
'default_refresh_secret',
102+
expiresIn: this.config.get<string>('JWT_REFRESH_EXPIRES_IN') || '7d',
101103
});
102104

103105
return { accessToken, refreshToken };

apps/backend/src/auth/strategies/jwt-refresh.strategy.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ export class JwtRefreshStrategy extends PassportStrategy(
1212
constructor(config: ConfigService) {
1313
super({
1414
jwtFromRequest: ExtractJwt.fromBodyField('refreshToken'),
15-
secretOrKey: config.get<string>('JWT_REFRESH_SECRET')!,
15+
secretOrKey:
16+
config.get<string>('JWT_REFRESH_SECRET') || 'default_refresh_secret',
1617
passReqToCallback: true,
1718
});
1819
}

apps/backend/src/auth/strategies/jwt.strategy.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class JwtStrategy extends PassportStrategy(Strategy, 'jwt') {
1212
) {
1313
super({
1414
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
15-
secretOrKey: config.get<string>('JWT_SECRET')!,
15+
secretOrKey: config.get<string>('JWT_SECRET') || 'default_secret',
1616
});
1717
}
1818

0 commit comments

Comments
 (0)