Skip to content

Commit

Permalink
πŸ”§ fix :login redirect ν˜•μ‹ μˆ˜μ •(#7):
Browse files Browse the repository at this point in the history
  • Loading branch information
jinddings committed Nov 12, 2024
1 parent 0f266d0 commit 9923b18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions BE/src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Req,
Res,
UnauthorizedException,
Redirect,
} from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiOperation } from '@nestjs/swagger';
Expand Down Expand Up @@ -59,10 +60,10 @@ export class AuthController {
) {
const { accessToken, refreshToken } =
await this.authService.kakaoLoginUser(authCredentialsDto);

res.cookie('accessToken', accessToken, { httpOnly: true });
res.cookie('refreshToken', refreshToken, { httpOnly: true });
res.cookie('isRefreshToken', true, { httpOnly: true });
return res.status(200).json({ accessToken });
return res.redirect(this.configService.get<string>('FRONTEND_URL'));
}

@ApiOperation({ summary: 'Refresh Token μš”μ²­ API' })
Expand All @@ -79,8 +80,9 @@ export class AuthController {

const newAccessToken = await this.authService.refreshToken(refreshToken);

res.cookie('accessToken', newAccessToken, { httpOnly: true });
res.cookie('refreshToken', refreshToken, { httpOnly: true });
res.cookie('isRefreshToken', true, { httpOnly: true });
return res.status(200).json({ accessToken: newAccessToken });
return res.redirect(this.configService.get<string>('FRONTEND_URL'));
}
}

0 comments on commit 9923b18

Please sign in to comment.