fix(auth): add reliable fallback for JWT secrets to prevent login signing crashes in production
Deploy Canina / deploy (push) Has been cancelled
Deploy Canina / deploy (push) Has been cancelled
This commit is contained in:
1 parent
f1b77f3fba
commit
9b7a9e363d
3 files changed
+20
-28
No files matched your search
@@ -13,10 +13,15 @@ export interface JwtPayload {
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(private readonly usersService: UsersService) {
|
||||
const secret =
|
||||
process.env.JWT_ACCESS_SECRET ||
|
||||
process.env.JWT_SECRET ||
|
||||
'canina_jwt_fallback_secret_32_characters_minimum_len_2026';
|
||||
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
ignoreExpiration: false,
|
||||
secretOrKey: process.env.JWT_ACCESS_SECRET!,
|
||||
secretOrKey: secret,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user