fix
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
background: rgba(255, 255, 255, 0.1);
|
background: rgba(255, 255, 255, 0.1);
|
||||||
border-radius: 20px;
|
border-radius: 20px;
|
||||||
backdrop-filter: blur(10px);
|
backdrop-filter: blur(10px);
|
||||||
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
.spinner {
|
.spinner {
|
||||||
border: 4px solid rgba(255, 255, 255, 0.3);
|
border: 4px solid rgba(255, 255, 255, 0.3);
|
||||||
@@ -35,6 +36,28 @@
|
|||||||
0% { transform: rotate(0deg); }
|
0% { transform: rotate(0deg); }
|
||||||
100% { transform: rotate(360deg); }
|
100% { transform: rotate(360deg); }
|
||||||
}
|
}
|
||||||
|
.message {
|
||||||
|
font-size: 18px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
.button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 15px 30px;
|
||||||
|
font-size: 18px;
|
||||||
|
font-weight: bold;
|
||||||
|
color: white;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
border: 2px solid white;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
transition: all 0.3s;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
.button:hover {
|
||||||
|
background: rgba(255, 255, 255, 0.3);
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
.error {
|
.error {
|
||||||
color: #ff6b6b;
|
color: #ff6b6b;
|
||||||
background: rgba(255, 255, 255, 0.9);
|
background: rgba(255, 255, 255, 0.9);
|
||||||
@@ -45,8 +68,10 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
|
<div id="content">
|
||||||
<div class="spinner"></div>
|
<div class="spinner"></div>
|
||||||
<p id="status">認証中...</p>
|
<p class="message">認証中...</p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
@@ -62,61 +87,38 @@
|
|||||||
console.log('OAuth callback page loaded');
|
console.log('OAuth callback page loaded');
|
||||||
console.log('Params:', { code: code ? 'present' : 'missing', state: state ? 'present' : 'missing' });
|
console.log('Params:', { code: code ? 'present' : 'missing', state: state ? 'present' : 'missing' });
|
||||||
|
|
||||||
|
const content = document.getElementById('content');
|
||||||
|
|
||||||
// エラーチェック
|
// エラーチェック
|
||||||
if (error) {
|
if (error) {
|
||||||
document.getElementById('status').innerHTML =
|
content.innerHTML = `<div class="error">認証エラー: ${errorDescription || error}</div>`;
|
||||||
`<div class="error">認証エラー: ${errorDescription || error}</div>`;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!code || !state) {
|
if (!code || !state) {
|
||||||
document.getElementById('status').innerHTML =
|
content.innerHTML = '<div class="error">認証パラメータが不足しています</div>';
|
||||||
'<div class="error">認証パラメータが不足しています</div>';
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// React Nativeアプリに戻す (deep link)
|
// Universal Links用: 現在のHTTPS URLがそのままアプリに渡される
|
||||||
|
// iOSがUniversal Linkを認識すれば自動的にアプリが開く
|
||||||
|
console.log('Waiting for Universal Link to trigger...');
|
||||||
|
|
||||||
|
// 3秒後にフォールバックメッセージを表示
|
||||||
|
setTimeout(() => {
|
||||||
|
// カスタムスキームのDeep Linkを生成(フォールバック用)
|
||||||
const deepLink = `aicard://oauth/callback?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`;
|
const deepLink = `aicard://oauth/callback?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state)}`;
|
||||||
|
|
||||||
console.log('Deep link:', deepLink);
|
content.innerHTML = `
|
||||||
document.getElementById('status').innerHTML = 'アプリに戻っています...<br><small>' + deepLink + '</small>';
|
<div class="message">認証が完了しました</div>
|
||||||
|
<p style="font-size: 14px; opacity: 0.9;">アプリが自動的に開かない場合は、<br>下のボタンをタップしてください</p>
|
||||||
// Method 1: iframe approach
|
<a href="${deepLink}" class="button">アプリを開く</a>
|
||||||
const iframe = document.createElement('iframe');
|
`;
|
||||||
iframe.style.display = 'none';
|
}, 3000);
|
||||||
iframe.src = deepLink;
|
|
||||||
document.body.appendChild(iframe);
|
|
||||||
|
|
||||||
// Method 2: Direct window.location
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Attempting window.location redirect');
|
|
||||||
window.location.href = deepLink;
|
|
||||||
}, 500);
|
|
||||||
|
|
||||||
// Method 3: Link click simulation
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Attempting link click');
|
|
||||||
const link = document.createElement('a');
|
|
||||||
link.href = deepLink;
|
|
||||||
link.click();
|
|
||||||
}, 1000);
|
|
||||||
|
|
||||||
// Method 4: Window.open
|
|
||||||
setTimeout(() => {
|
|
||||||
console.log('Attempting window.open');
|
|
||||||
window.open(deepLink, '_self');
|
|
||||||
}, 1500);
|
|
||||||
|
|
||||||
// フォールバック: 5秒後にメッセージ表示
|
|
||||||
setTimeout(() => {
|
|
||||||
document.getElementById('status').innerHTML =
|
|
||||||
'<div class="error">アプリが開かない場合は、下のリンクをタップしてください<br><br>' +
|
|
||||||
'<a href="' + deepLink + '" style="color: white; text-decoration: underline; font-size: 18px;">Aicardアプリを開く</a></div>';
|
|
||||||
}, 5000);
|
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Callback error:', err);
|
console.error('Callback error:', err);
|
||||||
document.getElementById('status').innerHTML =
|
document.getElementById('content').innerHTML =
|
||||||
`<div class="error">エラーが発生しました: ${err.message}</div>`;
|
`<div class="error">エラーが発生しました: ${err.message}</div>`;
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|||||||
Reference in New Issue
Block a user