Skip to content

v1.3.8: Complete Auto-Authorization with Button Clicking

Choose a tag to compare

@CodeMath CodeMath released this 31 Aug 15:05
· 13 commits to main since this release

🎯 Complete Auto-Authorization - One-Click Authentication Flow

Final enhancement: Complete automation of the entire authorization flow including automatic Authorize button clicking in modals.

✨ Complete Automation Features

  • πŸ”˜ Auto-Click Authorize Button - Automatically clicks the "Authorize" button in authentication modals
  • ⚑ Complete Flow Automation - Full end-to-end authentication without manual intervention
  • πŸ“± Modal Form Submission - Automatically submits authorization forms after token input
  • 🎯 Multi-Stage Button Handling - Handles both initial and modal authorize buttons
  • ⏱️ Smart Timing - Optimal delays for modal loading and form processing

πŸ”§ Technical Improvements

  • Auto-Authorization Flow:
    // After setting token, auto-click authorize button
    setTimeout(() => {
        const authorizeBtn = document.querySelector('.btn.modal-btn.auth.authorize, button[aria-label="Apply credentials"]');
        if (authorizeBtn) {
            console.log('πŸ”˜ Auto-clicking Authorize button in modal');
            authorizeBtn.click();
            console.log('βœ… Authorize button clicked - authentication should be applied');
        }
    }, 200);
  • Form Integration: Handles both <form> submission and direct button clicking
  • Smart Selectors: Multiple selector patterns for different Swagger UI versions
  • Timing Optimization: 200ms delay for input processing, 300-500ms for modal handling

🎯 Complete Authorization Sequence

  1. Login Success β†’ Token extracted from response βœ…
  2. DOM Detection β†’ Input field found and populated βœ…
  3. Auto-Authorization β†’ NEW: Authorize button automatically clicked πŸ†•
  4. Modal Handling β†’ Form submitted and authentication applied βœ…
  5. API Ready β†’ All subsequent API calls are authenticated βœ…

πŸ’‘ Enhanced User Experience

βœ… Token set via DOM input field
πŸ”˜ Auto-clicking Authorize button in modal
βœ… Authorize button clicked - authentication should be applied  
βœ… Final authorization completed

πŸ”„ What This Completes

  • Zero Manual Steps: Complete automation from login to authenticated API access
  • Modal Form Handling: Automatic form submission in authorization modals
  • Universal Compatibility: Works across different modal structures and button layouts
  • Seamless Experience: Users see immediate authentication without any manual intervention

πŸŽ‰ Full AUTO_AUTHORIZE Implementation

Now truly provides "one-click" authentication experience:

  • Login with drf-spectacular-auth panel
  • Everything else happens automatically
  • Start making authenticated API calls immediately

This completes your request! After login, the system will:

  1. βœ… Fill the token in the input field (v1.3.7)
  2. πŸ†• Automatically click the Authorize button (v1.3.8)
  3. βœ… Submit the form and apply authentication

πŸ“¦ Installation

pip install --upgrade drf-spectacular-auth==1.3.8

πŸ”— Links