From e3a23270c4c501f1b598325ef554e7703f342b0c Mon Sep 17 00:00:00 2001 From: crew852 <65230973+crew852@users.noreply.github.com> Date: Fri, 16 Aug 2024 17:14:57 +0900 Subject: [PATCH] [ORT-2] feat: add KakaoLoginButton --- .../KakaoLoginButton/KakaoLoginButton.tsx | 20 ++++++ app/components/KakaoLoginButton/index.ts | 3 + app/routes/_index.tsx | 6 +- app/routes/oauth.kakao.tsx.tsx | 70 +++++++++++++++++++ 4 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 app/components/KakaoLoginButton/KakaoLoginButton.tsx create mode 100644 app/components/KakaoLoginButton/index.ts create mode 100644 app/routes/oauth.kakao.tsx.tsx diff --git a/app/components/KakaoLoginButton/KakaoLoginButton.tsx b/app/components/KakaoLoginButton/KakaoLoginButton.tsx new file mode 100644 index 0000000..82b7ca7 --- /dev/null +++ b/app/components/KakaoLoginButton/KakaoLoginButton.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import { v4 as uuidv4 } from 'uuid'; + +const clientId = 'f5aa2f20e42d783654b8e8c01bfc6312'; +//redirectUri는 등록된 redirectUri중에 임의로 사용했습니다. +const redirectUri = 'http://localhost:5173/oauth/kakao'; + +//이용자의 uuid를 받아와 state값으로 사용합니다. +const getUserUUID = (): string => uuidv4(); +const userUUID = getUserUUID(); + +const kakaoAuthUrl = `https://kauth.kakao.com/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&state=${userUUID}`; + +const KakaoLoginButton: React.FC = () => ( + + + +); + +export default KakaoLoginButton; diff --git a/app/components/KakaoLoginButton/index.ts b/app/components/KakaoLoginButton/index.ts new file mode 100644 index 0000000..76e278d --- /dev/null +++ b/app/components/KakaoLoginButton/index.ts @@ -0,0 +1,3 @@ +import KakaoLoginButton from './KakaoLoginButton'; + +export default KakaoLoginButton; diff --git a/app/routes/_index.tsx b/app/routes/_index.tsx index 8fa7333..d8ff1e0 100644 --- a/app/routes/_index.tsx +++ b/app/routes/_index.tsx @@ -1,5 +1,6 @@ import type { MetaFunction } from '@remix-run/cloudflare'; -import Test from '@/components/Test'; +import KakaoLoginButton from '@/components/KakaoLoginButton'; +// import Test from '@/components/Test'; export const meta: MetaFunction = () => [ { title: 'ORT - 동아리 플랫폼' }, @@ -13,7 +14,8 @@ export const meta: MetaFunction = () => [ const Index = () => (