Guest User

Untitled

a guest
May 24th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. @Get()
  2. @UseGuards(AuthGuard('jwt'))
  3. async findAll(): Promise<UserDto[]> {
  4. return this.userService.findAll();
  5. }
  6.  
  7. async createToken() {
  8. const user: UserDto = { name: 'shamnad', phoneNumber: '12435' };
  9. return jwt.sign(user, 'secretkey'); // <== /! focus on this one /!
  10. }
  11.  
  12. async createToken() {
  13. const user: UserDto = { name: 'shamnad', phoneNumber: '12435' };
  14. return jwt.sign(user, 'secretKey'); // <== /! focus on this one /!
  15. }
  16.  
  17. constructor(private readonly authService: AuthService) {
  18. super({
  19. jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
  20. secretOrKey: 'secretKey', // <== /! focus on this line /!
  21. });
  22. }
Add Comment
Please, Sign In to add comment