Skip to content

Commit

Permalink
fix/#39/리프레쉬 토큰 검증키 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
gwgw123 committed Dec 23, 2024
1 parent 9804364 commit c6000d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, Res, UseGuards } from '@nestjs/common';
import { Controller, Get, Post, Res, UseGuards } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { User } from 'src/common/decorators/get-user.decorator';
import { ConfigService } from '@nestjs/config';
Expand All @@ -12,6 +12,7 @@ export class AuthController {
constructor(
private readonly authService: AuthService,
private readonly configService: ConfigService,
private readonly redisService: RedisService,
) {}

// Google 로그인 시작
Expand Down Expand Up @@ -60,7 +61,7 @@ export class AuthController {
@Get('/verify')
// @UseGuards(AuthGuard('jwt'))
@UseGuards(JwtGuard)
authTest(@User() user: any) {
tokenVerify(@User() user: any) {
return user;
}
}
4 changes: 2 additions & 2 deletions src/auth/jwt/jwt.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class JwtGuard implements CanActivate {
// refresh 토큰 변조, 만료를 검사
const payload = jwt.verify(
accessToken,
this.configService.get<string>('ACCESS_SECRET'),
this.configService.get<string>('REFRESH_SECRET'),
) as any;

const { userId } = payload;
Expand Down Expand Up @@ -88,7 +88,7 @@ export class JwtGuard implements CanActivate {
);
}

// Access 토큰을 쿠키에 설정
// access 토큰을 쿠키에 설정
private setAccessTokenCookie(request: Request, accessToken: string): void {
request.res?.cookie('accessToken', accessToken, {
httpOnly: true,
Expand Down

0 comments on commit c6000d3

Please sign in to comment.