Skip to content

Commit

Permalink
[Feat]소셜 로그인 후 토큰 저장 로직
Browse files Browse the repository at this point in the history
미완성
Issues #99
  • Loading branch information
김병현 authored and 김병현 committed Sep 15, 2023
1 parent 685968c commit d11ce54
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions client/src/components/Logins/OAuthLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ const OAuthLoginModal: React.FC<LoginModalProps> = ({ onClose, onEmailLoginClick
const emailLoginText = "이메일로 로그인";
const emailSignupText = "이메일로 회원가입";

// URL에서 엑세스 토큰과 리프레시 토큰을 추출합니다.
const urlParams = new URLSearchParams(window.location.search);
const accessToken = urlParams.get("access_token");
const refreshToken = urlParams.get("refresh_token");

if (accessToken && refreshToken) {
// 엑세스 토큰을 로컬 스토리지에 저장합니다.
localStorage.setItem("Authorization", `Bearer ${accessToken}`);

// 리프레시 토큰을 로컬 스토리지에 저장합니다.
localStorage.setItem("Refresh-token", refreshToken);
}



// const handleGoogleLogout = async () => {
// googleLogout();
Expand Down

0 comments on commit d11ce54

Please sign in to comment.