209 похожих чатов

Привет всем! Пытаюсь сделать авторизацию/аутентификацию на nestjs, но мне выдаёт

эту ошибку.

У меня код тупо пока копипастится с гитхаба нестджса. Вот код стратегий

jwt.strategy.ts

@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor() {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: jwtConstants.secret,
});
}

async validate(payload: any) {
return { userId: payload.sub, username: payload.username };
}
}

local.strategy.ts
@Injectable()
export class LocalStrategy extends PassportStrategy(Strategy) {
constructor(private readonly authService: UserService) {
super();
}

async validate(username: string, password: string): Promise<any> {
const user = await this.authService.validateUser(username, password);
if (!user) {
throw new UnauthorizedException();
}
return user;
}
}

Что тут не так? подскажите, пожалуйста, как это можно поправить?

1 ответов

20 просмотров

мб проблема в импорте https://stackoverflow.com/a/70119099/9108284

Похожие вопросы

Обсуждают сегодня

Ready for some fun AND a chance to win TKO Tokens? Join us for exciting minigames in our Telegram group! 🕒 Don’t miss out—games start on today 25 October 2024, at 8 PM! Ge...
Milkyway | Tokocrypto
255
How about the project bro Likes the community not that active ?
🅿️abby_FX
19
How are we going bro about the Raids ??
🅿️abby_FX
13
Keep saying it, it’s Trump or WW3. Iran will be emboldened if Harris wins by cheating. Israel will have to take the initiative against Iran. How has BTC faired everytime the...
Adz | Ferrum Network Product & Service Consultant @ Ferrum Network
1
------------------------------------------------------------------------------ 📢 MAJOR ANNOUNCEMENT: HSUITE ECOSYSTEM UPDATE 📢 @everyone Dear HbarSuite Community, After month...
Big Stones
3
isnt that how its called? lol
Hobbyist
34
Ok I will use this example…there has been a crazy amount of meme coins launched on solana and more recently on xrp ledger, many of these memes have found their way on to diffe...
Stevo Payne
7
Hey guys, I am a first time Staker, I'm on Chrome browser on Hex dot com, I'm using rabby wallet with my ledger nano X, but when I click the STAKE button it doesn't prompt my ...
Slug
8
VIP-391 Multichain Governance - Permissions on Ethereum, Arbitrum one and opBNB Summary If passed, following the Community proposal “Venus Upgrade - Omnichain Money Markets”...
Venus Announcements
6
Does anyone in here have a contact with EOS Labs that we could ask what they've been doing with their funding?
Bytecode360 Katoshi [1337 f4rm3r]
13
Карта сайта