Skip to content

Commit

Permalink
Merge pull request nestjs#53 from fmeynard/patch-1
Browse files Browse the repository at this point in the history
Update callback to throw UnauthorizedException
  • Loading branch information
kamilmysliwiec authored Mar 29, 2018
2 parents c10d020 + 3015f7f commit 07869f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/app/homepage/pages/recipes/passport/passport.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class AuthService {
return `
import * as passport from 'passport';
import { ExtractJwt, Strategy } from 'passport-jwt';
import { Component, Inject } from '@nestjs/common';
import { Component, Inject, UnauthorizedException } from '@nestjs/common';
import { AuthService } from '../auth.service';
@Component()
Expand All @@ -86,7 +86,7 @@ export class JwtStrategy extends Strategy {
public async verify(req, payload, done) {
const isValid = await this.authService.validateUser(payload);
if (!isValid) {
return done('Unauthorized', false);
return done(new UnauthorizedException(), false);
}
done(null, payload);
}
Expand Down

0 comments on commit 07869f3

Please sign in to comment.