-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
구글 및 카카오를 이용한 로그인 및 로그아웃 로직 구현
- Loading branch information
Showing
10 changed files
with
57 additions
and
114 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
This file was deleted.
Oops, something went wrong.
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
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
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,37 @@ | ||
import { useEffect } from "react"; | ||
import { useNavigate } from "react-router-dom"; | ||
import { | ||
useRecoilState, | ||
} from "recoil"; | ||
import { LoginState, AuthToken, LoggedUser } from "../recoil/state"; | ||
|
||
const Oauth = () => { | ||
const navigate = useNavigate(); | ||
const [isLogin, setIsLogin] = useRecoilState(LoginState); | ||
const [isToken, setToken] = useRecoilState(AuthToken); | ||
|
||
useEffect(() => { | ||
const query = window.location.search; | ||
const param = new URLSearchParams(query); | ||
|
||
const getaccessToken = param.get("accessToken"); | ||
const getId = param.get("id"); | ||
|
||
// console.log("팔람팔람팔람:",param) | ||
// console.log("퀄퀄:",query) | ||
// console.log("토토토토토토 :", getaccessToken) | ||
|
||
localStorage.setItem("Authorization",`Bearer ${getaccessToken}`) | ||
localStorage.setItem("memberId", `${getId}`) | ||
localStorage.setItem("loginStatus",`true`) | ||
setIsLogin(true); | ||
setToken(`Bearer ${getaccessToken}`); | ||
|
||
window.location.replace("/") | ||
; | ||
} ,[] | ||
) | ||
return <></> | ||
}; | ||
|
||
export default Oauth; |
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