Skip to content

Commit

Permalink
FEAT: ✨ extension 로그인 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
hoongding committed May 28, 2024
1 parent 79ce849 commit 3b58e4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const Login = () => {
useEffect(() => {
const handleTokenSaved = (event: MessageEvent) => {
if (event.origin === window.location.origin && event.data.tokenSaved) {
console.log('Token saved message received');
router.push('/');
}
};
Expand Down
6 changes: 6 additions & 0 deletions src/app/oauth2/redirect/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ const Redirect = () => {
if (token) {
document.cookie = `accessToken=${token}; path=/;`;

alert(process.env.NEXT_PUBLIC_EXTENSION_ID);
// TODO: 이쪽 부분에서 extension <> web 로그인 통신 진행
chrome?.runtime?.sendMessage(process.env.NEXT_PUBLIC_EXTENSION_ID, {
isLogin: true,
accessToken: token,
});

window.close();
window.opener.postMessage({ tokenSaved: true }, window.location.origin);
}
Expand Down

0 comments on commit 3b58e4a

Please sign in to comment.