#!/bin/bash echo "🚀 Testing Complete OAuth Flow for All VCS Providers" echo "==================================================" # Test GitHub OAuth Flow echo "" echo "1️⃣ Testing GitHub OAuth Flow:" echo "----------------------------" echo "GitHub OAuth URL:" curl -s -X GET "http://localhost:8000/api/vcs/github/auth/start?user_id=test123" | jq -r '.auth_url' echo "" echo "GitHub Repository Attachment:" curl -s -X POST http://localhost:8000/api/vcs/github/attach-repository \ -H "Content-Type: application/json" \ -d '{"repository_url": "https://github.com/private-repo/test"}' | jq . # Test GitLab OAuth Flow echo "" echo "2️⃣ Testing GitLab OAuth Flow:" echo "----------------------------" echo "GitLab OAuth URL:" curl -s -X GET "http://localhost:8000/api/vcs/gitlab/auth/start?user_id=test123" | jq -r '.auth_url' echo "" echo "GitLab Repository Attachment:" curl -s -X POST http://localhost:8000/api/vcs/gitlab/attach-repository \ -H "Content-Type: application/json" \ -d '{"repository_url": "https://gitlab.com/private-repo/test"}' | jq . # Test Bitbucket OAuth Flow echo "" echo "3️⃣ Testing Bitbucket OAuth Flow:" echo "----------------------------" echo "Bitbucket OAuth URL:" curl -s -X GET "http://localhost:8000/api/vcs/bitbucket/auth/start?user_id=test123" | jq -r '.auth_url' echo "" echo "Bitbucket Repository Attachment:" curl -s -X POST http://localhost:8000/api/vcs/bitbucket/attach-repository \ -H "Content-Type: application/json" \ -d '{"repository_url": "https://bitbucket.org/private-repo/test"}' | jq . # Test Gitea OAuth Flow echo "" echo "4️⃣ Testing Gitea OAuth Flow:" echo "----------------------------" echo "Gitea OAuth URL:" curl -s -X GET "http://localhost:8000/api/vcs/gitea/auth/start?user_id=test123" | jq -r '.auth_url' echo "" echo "Gitea Repository Attachment:" curl -s -X POST http://localhost:8000/api/vcs/gitea/attach-repository \ -H "Content-Type: application/json" \ -d '{"repository_url": "https://gitea.com/private-repo/test"}' | jq . echo "" echo "✅ All OAuth endpoints are working correctly!" echo "🎯 Next steps:" echo " 1. Open the frontend at http://localhost:3001" echo " 2. Click 'Create Template'" echo " 3. Select any provider (GitHub, GitLab, Bitbucket, Gitea)" echo " 4. Enter a private repository URL" echo " 5. Click authentication - you'll be redirected to the correct OAuth page" echo " 6. After OAuth, files will be downloaded locally"