fix(auth): add reliable fallback for JWT secrets to prevent login signing crashes in production
Deploy Canina / deploy (push) Has been cancelled

This commit is contained in:
parsa aghaei committed 2026-08-16 14:59:44 +03:30
1 parent f1b77f3fba
commit 9b7a9e363d
3 files changed
+20 -28

No files matched your search

+6 -1
View File
@@ -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,
});
}