mirror of
https://github.com/SyncrowIOT/backend.git
synced 2025-11-27 11:44:55 +00:00
authentication module done
This commit is contained in:
11
libs/common/src/guards/jwt.auth.guard.ts
Normal file
11
libs/common/src/guards/jwt.auth.guard.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { UnauthorizedException } from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
export class JwtAuthGuard extends AuthGuard('jwt') {
|
||||
handleRequest(err, user, info) {
|
||||
if (err || !user) {
|
||||
throw err || new UnauthorizedException();
|
||||
}
|
||||
return user;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user