scitex_browser.auth
scitex_browser.auth - Authentication helpers for browser automation.
Provides reusable authentication handlers for various OAuth providers and login flows used in browser automation tasks.
Features: - Google OAuth (popup-based flow) - Django session auth - Generic credential management
Example
from scitex_browser.auth import GoogleAuthHelper, google_login
# Quick login success = await google_login(page, “user@gmail.com”, “password”)
# Or with helper class auth = GoogleAuthHelper(email=”user@gmail.com”, password=”password”) success = await auth.login_via_google_button(page)
- class scitex_browser.auth.GoogleAuthHelper(email=None, password=None, debug=False)[source]
Bases:
objectGoogle OAuth authentication helper.
Handles the popup-based Google OAuth flow used by many services.
- Environment Variables:
GOOGLE_EMAIL: Default email if not provided GOOGLE_PASSWORD: Default password if not provided
- async login_via_google_button(page, google_button_selector='button:has-text("Continue with Google")', timeout=60000)[source]
Perform Google OAuth login via a “Continue with Google” button.
This handles the popup-based OAuth flow: 1. Click the Google button on the main page 2. Handle the Google popup for email/password entry 3. Wait for redirect back to the original service
- async _handle_consent_screens(popup)[source]
Handle OAuth consent or ‘Continue’ screens that may appear.
- Return type:
- async _wait_for_2fa(popup, timeout=60000)[source]
Wait for 2FA verification to complete.
Detects 2FA screens and waits for user to approve on their device.
- async scitex_browser.auth.google_login(page, email, password, button_selector='button:has-text("Continue with Google")', debug=False)[source]
Quick Google OAuth login.
- Parameters:
- Return type:
- Returns:
True if login successful, False otherwise
Example
success = await google_login(page, “user@gmail.com”, “password”)