You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How could I do user verification?
I want to implement the passport strategy and verify the validity of the JWT-token
import {Injectable} from '@nestjs/common';
import {PassportStrategy} from '@nestjs/passport';
import {passportJwtSecret} from 'jwks-rsa';
import {ExtractJwt, Strategy} from 'passport-jwt';
@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor() {
super({
secretOrKeyProvider: passportJwtSecret({
cache: true,
rateLimit: true,
jwksRequestsPerMinute: 5,
jwksUri: `https://######.clerk.accounts.dev/.well-known/jwks.json`,
}),
ignoreExpiration: false,
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
issuer: `https://######.clerk.accounts.dev`,
algorithms: ['RS256'],
});
}
public validate(payload: unknown): unknown {
console.log('Validating payload:', payload);
return payload;
}
}
import {Injectable} from '@nestjs/common';
import {AuthGuard} from '@nestjs/passport';
@Injectable()
export class JwtAuthGuard extends AuthGuard('jwt') {}
I would really appreciate some help as I didn't find enough information.
Thank you
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
How could I do user verification?
I want to implement the passport strategy and verify the validity of the JWT-token
I would really appreciate some help as I didn't find enough information.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions