Skip to content

Commit

Permalink
Merge pull request #5 from potenday-project/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
sparrowscout authored Dec 14, 2023
2 parents 0990f6a + eaf6b9f commit a13da0c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 6 deletions.
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

0 comments on commit a13da0c

Please sign in to comment.