feat: add reverse proxy OAuth configuration check script - Create check-proxy-oauth.sh for debugging reverse proxy setup - Add network connectivity tests for HTTPS and redirect URIs

This commit is contained in:
theshy
2025-08-01 20:44:48 +08:00
parent e955f4c317
commit 3acda2e9a3

View File

@ -0,0 +1,39 @@
#!/bin/bash
echo "🔍 检查反向代理 OAuth 配置..."
# 检查环境变量
echo "📋 环境变量检查:"
echo "NEXTAUTH_URL: ${NEXTAUTH_URL:-'未设置'}"
echo "NEXTAUTH_SECRET: ${NEXTAUTH_SECRET:-'未设置'}"
echo "GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID:-'未设置'}"
# 检查容器环境变量
echo ""
echo "🐳 Docker 容器环境变量:"
docker exec recorder-app env | grep -E "(NEXTAUTH|GOOGLE)" || echo "无法获取容器环境变量"
# 检查网络连接
echo ""
echo "🌐 网络连接检查:"
echo "HTTPS 连接测试:"
curl -I https://recorder.zyj.best 2>/dev/null | head -1 || echo "无法连接到 HTTPS 网站"
echo ""
echo "🔗 重定向 URI 测试:"
curl -I https://recorder.zyj.best/api/auth/callback/google 2>/dev/null | head -1 || echo "重定向 URI 无法访问"
# 检查应用日志
echo ""
echo "📝 最近的认证日志:"
docker logs recorder-app --tail 50 | grep -i "auth\|oauth\|redirect" || echo "未找到相关日志"
echo ""
echo "✅ 检查完成!"
echo ""
echo "📋 配置建议:"
echo "1. Google Cloud Console 中设置:"
echo " - Authorized JavaScript origins: https://recorder.zyj.best"
echo " - Authorized redirect URIs: https://recorder.zyj.best/api/auth/callback/google"
echo "2. 确保 NEXTAUTH_URL=https://recorder.zyj.best"
echo "3. 重启应用: ./deploy.sh"