codenuk_backend_mine/test-oauth-flow.sh
2025-10-15 08:00:16 +05:30

63 lines
2.4 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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"