-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into ORT-3_api
- Loading branch information
Showing
8 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React, { useMemo } from 'react'; | ||
import { getUUID } from '@/utils/random'; | ||
|
||
const clientId = 'f5aa2f20e42d783654b8e8c01bfc6312'; | ||
//redirectUri는 등록된 redirectUri중에 임의로 사용했습니다. | ||
const redirectUri = 'http://localhost:5173/oauth/kakao'; | ||
|
||
const KakaoLoginButton: React.FC = () => { | ||
const kakaoAuthUrl = useMemo(() => { | ||
const userUUID = getUUID(); | ||
return `https://kauth.kakao.com/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&state=${userUUID}`; | ||
}, []); | ||
|
||
return ( | ||
<a href={kakaoAuthUrl}> | ||
<button>카카오로 로그인</button> | ||
</a> | ||
); | ||
}; | ||
|
||
export default KakaoLoginButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import KakaoLoginButton from './KakaoLoginButton'; | ||
|
||
export default KakaoLoginButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { LoaderFunction, json } from '@remix-run/cloudflare'; | ||
|
||
export const loader: LoaderFunction = async ({ request }) => { | ||
const url = new URL(request.url); | ||
const code = url.searchParams.get('code'); | ||
const state = url.searchParams.get('state'); | ||
|
||
// 이 아래의 try문 지우고 이어서 하면 됩니다 | ||
try { | ||
console.log(code, state); | ||
} catch { | ||
console.log(json); | ||
} | ||
}; | ||
|
||
const KakaoRedirect = () => <div>카카오 로그인 중...</div>; | ||
|
||
export default KakaoRedirect; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { v4 as uuidv4 } from 'uuid'; | ||
|
||
//이용자의 uuid를 받아옵니다. | ||
export const getUUID = () => uuidv4(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.