incomplete oauth

This commit is contained in:
Gabriel Rosa
2022-06-20 15:07:23 -03:00
parent 668c5fe6a5
commit 8c91551cdc
3 changed files with 169 additions and 0 deletions
@@ -0,0 +1,18 @@
import { Strategy } from 'passport-hubspot';
import { PassportStrategy } from '@nestjs/passport';
import { Injectable, UnauthorizedException } from '@nestjs/common';
@Injectable()
export class HubspotStrategy extends PassportStrategy(Strategy) {
constructor(private authService: AuthService) {
super();
}
async validate(username: string, password: string): Promise<any> {
const user = await this.authService.validateUser(username, password);
if (!user) {
throw new UnauthorizedException();
}
return user;
}
}