Skip to content

Commit

Permalink
fix(#10) : 리프레시 토큰 다시 로컬 스토리지에 저장하는 방식으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
NicoDora committed Nov 28, 2023
1 parent 3a95e78 commit c1191f6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
18 changes: 2 additions & 16 deletions src/auth/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ export class AuthController {
naverRefreshToken,
);

res.cookie('refresh_token', refreshToken, {
httpOnly: true,
sameSite: 'Lax',
domain: 'localhost',
maxAge: 1000 * 60 * 60 * 24 * 7, // 7일
});

return res.json({ accessToken });
return res.json({ accessToken, refreshToken });
}

@ApiKakaoLogin()
Expand All @@ -81,14 +74,7 @@ export class AuthController {
kakaoRefreshToken,
);

res.cookie('refresh_Token', refreshToken, {
httpOnly: true,
sameSite: 'Lax',
domain: 'localhost',
maxAge: 1000 * 60 * 60 * 24 * 7, // 7일
});

return res.json({ accessToken });
return res.json({ accessToken, refreshToken });
}

@ApiCookieAuth('refresh-token')
Expand Down
2 changes: 1 addition & 1 deletion src/config/guards/jwt-refresh-token.guard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export class JwtRefreshTokenGuard {

async canActivate(context: ExecutionContext) {
const request = context.switchToHttp().getRequest();
const refreshToken = request.cookies['refresh_token'];
const refreshToken = request.headers['refresh_token'];

if (!refreshToken) {
return false;
Expand Down

0 comments on commit c1191f6

Please sign in to comment.