Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #5

Merged
merged 3 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ jobs:
build:
runs-on: ubuntu-20.04
env:
REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }}
REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
REACT_APP_KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down Expand Up @@ -41,6 +43,8 @@ jobs:
echo "REACT_APP_REGION=$REACT_APP_REGION" >> .env.production

env:
REACT_APP_NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
REACT_APP_NAVER_REDIRECT_URI: ${{ secrets.NAVER_REDIRECT_URI }}
REACT_APP_KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
REACT_APP_KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
REACT_APP_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand Down
2 changes: 0 additions & 2 deletions src/component/home/KakaoOauth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,5 @@ export default function KakaoOauth() {
const urlParams = new URLSearchParams(location.search);
const codeValue = urlParams.get('code');

console.log(codeValue);

return <>카카오 리다이렉트 페이지</>;
}
9 changes: 9 additions & 0 deletions src/component/home/NaverOauth.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { useLocation } from 'react-router';

export default function NaverOauth() {
const location = useLocation();
const urlParams = new URLSearchParams(location.search);
const codeValue = urlParams.get('code');

return <>네이버 리다이렉트 페이지</>;
}
16 changes: 13 additions & 3 deletions src/pages/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ export default function Login() {
window.location.href = kakaoLoginURL;
};

const kakaoClientId = process.env.REACT_APP_KAKAO_CLIENT_ID;
const onClickNaverLogin = () => {
window.location.href = naverLoginURL;
};

const naverClientID = process.env.REACT_APP_NAVER_CLIENT_ID;
const naverRedirectURI = process.env.REACT_APP_NAVER_REDIRECT_URI;
const naverLoginURL = `https://nid.naver.com/oauth2.0/authorize?client_id=${naverClientID}&response_type=code&redirect_uri=${naverRedirectURI}`;

const kakaoClientID = process.env.REACT_APP_KAKAO_CLIENT_ID;
const kakaoRedirectURI = process.env.REACT_APP_KAKAO_REDIRECT_URI;
const kakaoLoginURL = `https://kauth.kakao.com/oauth/authorize?client_id=${kakaoClientId}&redirect_uri=${kakaoRedirectURI}&response_type=code`;
const kakaoLoginURL = `https://kauth.kakao.com/oauth/authorize?client_id=${kakaoClientID}&redirect_uri=${kakaoRedirectURI}&response_type=code`;

return (
<LoginPageContainer>
Expand All @@ -24,7 +32,9 @@ export default function Login() {
</LoginTitleContainer>

<SocialLoginContainer>
<NaverLoginBtn>네이버로 로그인하기</NaverLoginBtn>
<NaverLoginBtn onClick={onClickNaverLogin}>
네이버로 로그인하기
</NaverLoginBtn>
<KakaoLoginBtn onClick={onClickKakaoLogin}>
카카오톡으로 로그인하기
</KakaoLoginBtn>
Expand Down
6 changes: 5 additions & 1 deletion src/routes/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import DefaultLayout from 'layout/DefaultLayout';
import Login from 'pages/Login';
import Home from 'pages/Home';
import KakaoOauth from 'component/home/KakaoOauth';
import NaverOauth from 'component/home/NaverOauth';

export const router = createBrowserRouter([
{
Expand All @@ -15,7 +16,10 @@ export const router = createBrowserRouter([
{ path: '/login', element: <Login /> },
{
path: '/oauth',
children: [{ path: 'kakao', element: <KakaoOauth /> }],
children: [
{ path: 'kakao', element: <KakaoOauth /> },
{ path: 'naver', element: <NaverOauth /> },
],
},
],
},
Expand Down
Loading