Files
server-configs/oauth-callback.html
2026-02-13 22:24:27 +08:00

48 lines
1.5 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<title>OAuth Callback Handler</title>
<meta charset="UTF-8">
</head>
<body>
<h1>OAuth 回调处理</h1>
<p>正在处理授权回调...</p>
<div id="result"></div>
<script>
// 获取 URL 参数
function getQueryParam(name) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(name);
}
// 显示结果
function showResult(message) {
document.getElementById('result').innerHTML = '<pre>' + message + '</pre>';
}
// 处理回调
window.onload = function() {
const code = getQueryParam('code');
const state = getQueryParam('state');
const error = getQueryParam('error');
if (error) {
showResult('授权失败: ' + error);
return;
}
if (code) {
showResult('授权成功!\n\n授权码 (code): ' + code + '\n状态 (state): ' + state + '\n\n请复制这个授权码然后在滴答清单开发者中心交换 Access Token。');
// 可以在这里发送授权码到后端
console.log('授权码:', code);
console.log('状态:', state);
} else {
showResult('未找到授权码。请确保从滴答清单正确重定向。');
}
};
</script>
</body>
</html>