I am creating this issue just in case if someone is following the nodejs tutorial on freecodecamp and facing issue while implementing the JWT strategy.
mikenicholson/passport-jwt#153
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor(private configService: ConfigService) {
super({
secretOrKey: configService.get('JWT_SECRET'),
jwtFromRequest: ExtractJwt.fromAuthHeaderWithScheme('Bearer'), //instead of ExtractJwt.fromAuthHeaderAsBearerToken()
ignoreExpiration: true,
});
}
validate(payload: any) {
console.log(payload);
return payload;
}
While calling the request you can normally pass Authorization header as Bearer ${token}
I am creating this issue just in case if someone is following the nodejs tutorial on freecodecamp and facing issue while implementing the JWT strategy.
mikenicholson/passport-jwt#153
While calling the request you can normally pass
Authorizationheader asBearer ${token}