From 0da0a2997e4ed361d77c887d285bd68f805770e0 Mon Sep 17 00:00:00 2001 From: HeoJiye Date: Wed, 6 Mar 2024 14:58:30 +0900 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20=EA=B0=9C=EB=B0=9C=20=ED=99=98?= =?UTF-8?q?=EA=B2=BD=EC=97=90=20=EB=94=B0=EB=9D=BC=EC=84=9C=20headerOption?= =?UTF-8?q?s=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/hooks/auth/useKakaoOAuthRedirect.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/business/hooks/auth/useKakaoOAuthRedirect.ts b/frontend/src/business/hooks/auth/useKakaoOAuthRedirect.ts index 711c4e96..cd0452b8 100644 --- a/frontend/src/business/hooks/auth/useKakaoOAuthRedirect.ts +++ b/frontend/src/business/hooks/auth/useKakaoOAuthRedirect.ts @@ -9,14 +9,13 @@ export function useKakaoOAuthRedirect() { const navigate = useNavigate(); const code = new URLSearchParams(window.location.search).get('code'); + const headerOptions = isProdctionMode() ? { SameSite: 'None', Secure: true } : {}; + const login = async () => { const res = await axios.get(KAKAO_LOGIN_URL, { params: { code }, withCredentials: true, - headers: { - SameSite: 'None', - Secure: isProdctionMode(), - }, + headers: headerOptions, }); if (!res || res.status !== 200) { From 3a986077695d9ede1259e74c8deacf435b8ec20a Mon Sep 17 00:00:00 2001 From: kimyu0218 Date: Wed, 6 Mar 2024 19:43:33 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20=EA=B0=9C=EB=B0=9C=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EC=97=90=20=EB=94=B0=EB=9D=BC=20sameSite=20=EB=8B=A4=EB=A5=B4?= =?UTF-8?q?=EA=B2=8C=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/was/src/auth/auth.controller.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/was/src/auth/auth.controller.ts b/backend/was/src/auth/auth.controller.ts index d79c4fd1..d6465a2d 100644 --- a/backend/was/src/auth/auth.controller.ts +++ b/backend/was/src/auth/auth.controller.ts @@ -30,7 +30,7 @@ export class AuthController { this.cookieOptions = { httpOnly: true, secure: process.env.ENV === 'PROD', - sameSite: 'none', + sameSite: process.env.ENV === 'PROD' ? 'none' : 'lax', maxAge: 3600000, }; } From 09ea8e41b12b716a39be62357dd5ff83e482e29d Mon Sep 17 00:00:00 2001 From: HeoJiye Date: Fri, 8 Mar 2024 16:42:55 +0900 Subject: [PATCH 3/6] =?UTF-8?q?design:=20chatlog=20sidebar=20padding=20?= =?UTF-8?q?=EA=B0=92=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/aiChatPage/ChatLogContainer/ChatLogContainer.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/aiChatPage/ChatLogContainer/ChatLogContainer.tsx b/frontend/src/components/aiChatPage/ChatLogContainer/ChatLogContainer.tsx index 7d24088b..36201fd9 100644 --- a/frontend/src/components/aiChatPage/ChatLogContainer/ChatLogContainer.tsx +++ b/frontend/src/components/aiChatPage/ChatLogContainer/ChatLogContainer.tsx @@ -6,7 +6,7 @@ export function ChatLogContainer() { const { list } = useChatLogList(); return ( -
+
From 6841a4eee367eb84111003d990c2d87292133ee5 Mon Sep 17 00:00:00 2001 From: HeoJiye Date: Fri, 8 Mar 2024 16:54:45 +0900 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=ED=86=A1=20=EB=A1=9C=EA=B7=B8=EC=95=84=EC=9B=83=20=EB=B2=84?= =?UTF-8?q?=ED=8A=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/business/hooks/auth/useKakaoOAuth.ts | 13 ++++++++-- .../common/Buttons/KakaoLoginoutButton.tsx | 26 +++++++++++++++++++ frontend/src/constants/kakao.ts | 1 + frontend/src/pages/AIChatPage/AIChatPage.tsx | 2 ++ 4 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 frontend/src/components/common/Buttons/KakaoLoginoutButton.tsx diff --git a/frontend/src/business/hooks/auth/useKakaoOAuth.ts b/frontend/src/business/hooks/auth/useKakaoOAuth.ts index c1a7d867..38bcdc53 100644 --- a/frontend/src/business/hooks/auth/useKakaoOAuth.ts +++ b/frontend/src/business/hooks/auth/useKakaoOAuth.ts @@ -1,9 +1,18 @@ -import { KAKAO_AUTH_URL } from '@constants/kakao'; +import axios from 'axios'; + +import { KAKAO_AUTH_URL, KAKAO_LOGOUT_URL } from '@constants/kakao'; export function useKakaoOAuth() { const requestAuthorization = () => { window.location.href = KAKAO_AUTH_URL; }; - return { requestAuthorization }; + const logout = async () => { + const res = await axios.get(KAKAO_LOGOUT_URL); + if (res.status === 200) { + window.location.reload(); + } + }; + + return { requestAuthorization, logout }; } diff --git a/frontend/src/components/common/Buttons/KakaoLoginoutButton.tsx b/frontend/src/components/common/Buttons/KakaoLoginoutButton.tsx new file mode 100644 index 00000000..7fb9124b --- /dev/null +++ b/frontend/src/components/common/Buttons/KakaoLoginoutButton.tsx @@ -0,0 +1,26 @@ +import { Button } from '.'; + +import { useKakaoOAuth } from '@business/hooks/auth'; + +import { Icon } from '@iconify/react'; + +interface KakaoLoginoutButtonProps {} + +export function KakaoLoginoutButton({}: KakaoLoginoutButtonProps) { + const { logout } = useKakaoOAuth(); + + return ( + + ); +} diff --git a/frontend/src/constants/kakao.ts b/frontend/src/constants/kakao.ts index 9668e725..8e9e3ec9 100644 --- a/frontend/src/constants/kakao.ts +++ b/frontend/src/constants/kakao.ts @@ -7,3 +7,4 @@ export const KAKAO_AUTH_URL = `&redirect_uri=${import.meta.env.VITE_KAKAO_REDIRECT_URI}`; export const KAKAO_LOGIN_URL = import.meta.env.VITE_WAS_URL + '/oauth/login/kakao'; +export const KAKAO_LOGOUT_URL = import.meta.env.VITE_WAS_URL + '/oauth/logout'; diff --git a/frontend/src/pages/AIChatPage/AIChatPage.tsx b/frontend/src/pages/AIChatPage/AIChatPage.tsx index d1ef7e25..38799a12 100644 --- a/frontend/src/pages/AIChatPage/AIChatPage.tsx +++ b/frontend/src/pages/AIChatPage/AIChatPage.tsx @@ -1,5 +1,6 @@ import { ChatLogContainer } from '@components/aiChatPage'; import { Background, ChatContainer, Header } from '@components/common'; +import { KakaoLoginoutButton } from '@components/common/Buttons/KakaoLoginoutButton'; import { SideBarButton } from '@components/common/SideBar'; import { useAiChatMessage } from '@business/hooks/chatMessage'; @@ -26,6 +27,7 @@ export function AIChatPage({}: AIChatPageProps) { rightItems={ data?.isAuthenticated ? [ + , Date: Fri, 8 Mar 2024 16:55:11 +0900 Subject: [PATCH 5/6] =?UTF-8?q?design:=20rightItem=20=EC=97=AC=EB=9F=AC?= =?UTF-8?q?=EA=B0=9C=EC=9D=BC=20=EB=95=8C=20=EA=B3=A0=EB=A0=A4=ED=95=B4?= =?UTF-8?q?=EC=84=9C=20=EC=8A=A4=ED=83=80=EC=9D=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/common/Header/Header.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/common/Header/Header.tsx b/frontend/src/components/common/Header/Header.tsx index 62d815e8..1751336f 100644 --- a/frontend/src/components/common/Header/Header.tsx +++ b/frontend/src/components/common/Header/Header.tsx @@ -8,14 +8,11 @@ export function Header({ rightItems }: HeaderProps) { return (
- {rightItems?.map((item, index) => ( -
- {item} -
- ))} +
+ {rightItems?.map((item, index) => ( +
{item}
+ ))} +
); } From eb9f0598b819db1810a45cb1d08ebfbdd42f914b Mon Sep 17 00:00:00 2001 From: HeoJiye Date: Fri, 8 Mar 2024 19:18:24 +0900 Subject: [PATCH 6/6] =?UTF-8?q?chore:=20withCredentials=20=EC=98=B5?= =?UTF-8?q?=EC=85=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/business/hooks/auth/useKakaoOAuth.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/business/hooks/auth/useKakaoOAuth.ts b/frontend/src/business/hooks/auth/useKakaoOAuth.ts index 38bcdc53..43cb36ff 100644 --- a/frontend/src/business/hooks/auth/useKakaoOAuth.ts +++ b/frontend/src/business/hooks/auth/useKakaoOAuth.ts @@ -8,7 +8,7 @@ export function useKakaoOAuth() { }; const logout = async () => { - const res = await axios.get(KAKAO_LOGOUT_URL); + const res = await axios.get(KAKAO_LOGOUT_URL, { withCredentials: true }); if (res.status === 200) { window.location.reload(); }