fix: enhance OAuth configuration and add debugging - Add Google OAuth authorization parameters - Add environment variable validation - Add debugging logs for redirect callback - Create OAuth configuration check script

This commit is contained in:
theshy
2025-08-01 20:42:03 +08:00
parent 2cd0ebda65
commit e955f4c317
8 changed files with 195 additions and 358 deletions

32
scripts/check-oauth.sh Normal file
View File

@ -0,0 +1,32 @@
#!/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 "📝 最近的认证日志:"
docker logs recorder-app --tail 50 | grep -i "auth\|oauth\|redirect" || echo "未找到相关日志"
# 检查网络连接
echo ""
echo "🌐 网络连接检查:"
curl -I https://recorder.zyj.best 2>/dev/null | head -1 || echo "无法连接到网站"
echo ""
echo "✅ 检查完成!"
echo ""
echo "📋 下一步操作:"
echo "1. 确保 Google Cloud Console 中配置了正确的重定向 URI"
echo "2. 重启应用: ./deploy.sh"
echo "3. 检查日志: docker logs recorder-app"