src/module/auth/strategy/picture.strategy.ts
Methods |
|
constructor(authService: AuthService)
|
||||||
Parameters :
|
Async validate | ||||||
validate(payload: any)
|
||||||
Parameters :
Returns :
{}
|
import { PassportStrategy } from "@nestjs/passport";
import { ExtractJwt, Strategy } from "passport-jwt";
import { Config } from "../../config/entity/config";
import { Injectable } from "@nestjs/common";
import { AuthService } from "../service/auth.service";
@Injectable()
export class JwtQueryStrategy extends PassportStrategy(Strategy, "jwt-query") {
constructor(private readonly authService: AuthService) {
super({
jwtFromRequest: ExtractJwt.fromUrlQueryParameter("token"),
secretOrKey: Config.get("JWT_SECRET"),
});
}
async validate(payload: any) {
return await this.authService.authorize(payload.sub);
}
}