Skip to content

Commit 1011d9d

Browse files
minsukim-29cmclaude
andcommitted
fix: Chrome Custom Tabs 커스텀 스킴 차단 우회를 위해 setTimeout 추가
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 8a22b13 commit 1011d9d

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/hooks/useSocialAuth.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,11 @@ export const useSocialAuth = () => {
202202

203203
if (parsedState?.fromWebView) {
204204
// WebView에서 온 경우 커스텀 스킴으로 복귀 (Android/iOS 모두 동일)
205+
// Chrome Custom Tabs에서 자동 리다이렉트 차단을 우회하기 위해 약간 지연
205206
const errorParam = `error=${encodeURIComponent(error)}`;
206-
window.location.href = `${URL_SCHEME}?${errorParam}`;
207+
setTimeout(() => {
208+
window.location.href = `${URL_SCHEME}?${errorParam}`;
209+
}, 100);
207210
} else {
208211
setError('로그인에 실패했습니다. 다시 시도해주세요.');
209212
setIsLoading(false);
@@ -217,8 +220,11 @@ export const useSocialAuth = () => {
217220

218221
if (parsedState?.fromWebView) {
219222
// WebView에서 온 경우 커스텀 스킴으로 복귀 (Android/iOS 모두 동일)
223+
// Chrome Custom Tabs에서 자동 리다이렉트 차단을 우회하기 위해 약간 지연
220224
const params = `code=${encodeURIComponent(code)}&provider=${parsedState.provider || ''}&state=${encodeURIComponent(stateParam || '')}`;
221-
window.location.href = `${URL_SCHEME}?${params}`;
225+
setTimeout(() => {
226+
window.location.href = `${URL_SCHEME}?${params}`;
227+
}, 100);
222228
} else {
223229
// 브라우저에서 온 경우: URL 파라미터 제거 후 처리하여 무한 루프 방지
224230
const provider = location.pathname.split('/').at(-1);

0 commit comments

Comments
 (0)