[ADD] google auth guard
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
// google-auth.guard.ts
|
||||
|
||||
import { ExecutionContext, Injectable } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Injectable()
|
||||
export class GoogleAuthGuard extends AuthGuard('google') {
|
||||
async canActivate(context: ExecutionContext): Promise<boolean> {
|
||||
const result = (await super.canActivate(context)) as boolean;
|
||||
const request = context.switchToHttp().getRequest();
|
||||
await super.logIn(request);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user