Skip to content

Commit

Permalink
Merge pull request #319 from Team-SilverTown/fix/auth/#318
Browse files Browse the repository at this point in the history
  • Loading branch information
IjjS authored Apr 22, 2024
2 parents fe0fc0b + caf6d6c commit 69c9b4d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ export async function middleware(request: NextRequest) {
const response = NextResponse.redirect(request.url);
// 쿠키 갱신
apiClient.setDefaultHeader("Authorization", `Bearer ${newServiceToken}`);
response.cookies.set(sessionCookie, newSessionToken);
response.cookies.set(sessionCookie, newSessionToken, {
httpOnly: true,
secure: process.env.NEXTAUTH_URL?.startsWith("https://"),
sameSite: "lax",
});

// response 뿐만이 아니라 request 에서도 갱신된 쿠키를 바라볼 수 있도록 함
applySetCookie(request, response);
return response;
Expand Down

0 comments on commit 69c9b4d

Please sign in to comment.