-
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.
Merge pull request #419 from depromeet/bugfix/409/externalBrowser
fix: #409 웹 환경에서 카카오 브라우저 로그인 시, 소셜 로그인 정책 우회
- Loading branch information
Showing
4 changed files
with
23 additions
and
21 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Fragment, PropsWithChildren } from "react"; | ||
|
||
export function PreventExternalBrowser({ children }: PropsWithChildren) { | ||
const agent = navigator.userAgent; | ||
const URL = document.URL; | ||
const isKakao = agent.includes("KAKAO"); | ||
const isInstagram = agent.includes("Instagram"); | ||
|
||
if (isKakao) { | ||
window.open(`kakaotalk://web/openExternal?url=${encodeURIComponent(URL)}`); | ||
return <span> 시스템 브라우저를 이용해주세요 </span>; | ||
} else if (isInstagram) { | ||
/** | ||
* NOTE: 현재는 해당 인스타그램 인앱 탈출 코드가 작동하지 않는 것 같음 | ||
* 추후 카카오톡처럼 인스타그램 인앱 방지 분석 후 코드 추가 예정 | ||
*/ | ||
} | ||
return <Fragment> {children} </Fragment>; | ||
} |
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