# Civic Auth Django Integration Prompt## PrerequisitesBefore starting, you need a Civic Auth Client ID:1. Visit https://auth.civic.com2. Sign up or log in to your account3. Create a new application to obtain your Client ID4. Copy the Client ID for use in this integration## TaskAdd Civic Auth authentication to this Django application.## Step 1: Fetch the DocumentationUse curl to fetch the Civic Auth Django documentation:curl https://docs.civic.com/integration/python/django.mdThis documentation contains ALL the code examples and instructions needed for the integration. Do NOT use web search or any other tools - only use curl to fetch this specific URL.## Step 2: Gather Project InformationAsk the user for the following information if not provided:**Required Information (gather ALL before starting):**- ✅ Client ID (if not provided, ask user to get it from https://auth.civic.com)- ✅ Project type (new/existing Django project)- ✅ Python environment setup (virtual environment, dependencies)- ✅ Django version and project structure- ✅ Protected views/URLs that need authentication- ✅ Existing authentication systems that need replacement- ✅ Template preferences (using Django templates vs JSON API responses)- ✅ Django REST Framework usage (if applicable)- ✅ Deployment environment (local development, production URLs)**DO NOT proceed with implementation until you have confirmed ALL of the above information.**If any information is missing, ask specific questions and wait for responses before continuing. This prevents errors and ensures the integration matches the user's exact requirements.## Step 3: Create Implementation PlanAfter fetching the documentation with curl:1. Analyze the current Django project structure2. Identify which code examples from the documentation apply3. Plan the implementation order (settings, middleware, URLs, views)4. Note any existing authentication code that needs to be modified5. Determine if templates or API responses are needed6. Check for Django REST Framework compatibility needs## Step 4: Implement Civic AuthUsing ONLY the documentation fetched via curl:1. Follow the Quick Start guide step by step2. Install the required civic-auth[django] package3. Configure Django settings with CIVIC_AUTH configuration4. Add the CivicAuthMiddleware to MIDDLEWARE5. Include the auth URLs in your URL patterns6. Create and protect views with @civic_auth_required decorator7. Set up templates if needed8. Handle Django REST Framework integration if applicable9. Adapt all code examples to this project's structure## Important Notes- Use ONLY curl to fetch the documentation - no web search tools- The fetched documentation is the ONLY source of truth for this implementation- All code examples, configuration options, and setup instructions are in that document- Pay attention to Django version compatibility and dependency requirements- Ensure proper virtual environment setup if needed- The civic_user is available on request.civic_user with attributes like .name, .email, .id, .picture- Middleware must be added to MIDDLEWARE list in settings.py- URLs must include get_auth_urls() for authentication routes## CRITICAL: Information Gathering RequirementsYou MUST gather ALL required information from the user before proceeding with ANY implementation steps:**Required Information (gather ALL before starting):**- ✅ Client ID (if not provided, stop and ask user to get it from https://auth.civic.com)- ✅ Project type (new/existing Django project)- ✅ Python environment details- ✅ Django version and project structure- ✅ Protected views that need authentication- ✅ Existing authentication systems that need replacement- ✅ Template vs API response preferences- ✅ Django REST Framework usage- ✅ Deployment configuration (URLs for redirect_url and post_logout_redirect_url)**DO NOT proceed with implementation until you have confirmed ALL of the above information with the user.**If any information is missing, ask specific questions and wait for responses before continuing. This prevents errors and ensures the integration matches the user's exact requirements.## Next StepsAfter completing basic authentication integration:- Test the authentication flow with /auth/login- Verify protected views work correctly- Update URLs for production deployment- Add additional protected views as needed- Create templates for better user experience- Set up Django REST Framework endpoints if needed
Need help? If you encounter any issues during the LLM-assisted integration, you can always fall back to the manual Django integration guide.