Authentication handling covers every pattern encountered in production integration work: OAuth 2.0 authorization code flow with PKCE (RFC 7636) for public clients where client_secret cannot be stored securely; client credentials flow for machine-to-machine integrations; token refresh rotation with Redis storing the access token, expiry, and refresh token with a mutex lock to prevent concurrent refresh races (two parallel calls both finding an expired token and both trying to refresh, invalidating one mid-flight); API key rotation support (the integration operates with old and new keys during rotation windows without downtime); SAML 2.0 for enterprise SSO-gated systems; session-based authentication for legacy web systems where a login POST establishes a session cookie that must be maintained across requests. Token expiry is detected proactively (5 minutes before expiry) rather than reactively (after receiving a 401), proactive refresh eliminates the latency spike caused by token expiry mid-workflow execution.
Rate limit management: each integration is configured with a rate limit budget (requests per second, requests per day, concurrent request limit) tracked via a token bucket counter in Redis. When a request approaches the budget ceiling (within 20% of the daily limit), subsequent requests are queued rather than sent immediately. When a 429 is received despite proactive management, the integration extracts the Retry-After header and waits exactly the specified duration before retrying, not a fixed backoff that may be shorter or longer than the API requires. For APIs without Retry-After, exponential backoff: 1s, 2s, 4s, 8s, 16s, 32s, then permanent failure to DLQ. The rate limit consumption per integration is visible in the monitoring dashboard, showing current usage as a percentage of the daily budget so operations teams can see if business activity spikes are approaching the Salesforce API budget ceiling before it becomes a hard failure.
Screen scraping for legacy systems without APIs: Playwright-based automation with browser fingerprint randomisation (user-agent rotation, viewport variation, JavaScript timing randomisation) for government portals and legacy vendor portals with anti-bot detection. Cookie session management handles multi-page authentication flows (login form → MFA prompt → dashboard → data export page). DOM selectors prioritise stable attributes (data-testid, aria-label, form name attributes) over brittle positional CSS selectors, the former survives UI redesigns, the latter breaks silently. Extracted data is validated against an expected schema before downstream processing, so a portal layout change that disrupts extraction triggers an alert rather than silently producing malformed data.
File-based integration for systems with no API and no web interface: SFTP polling with SHA-256 file fingerprinting to prevent reprocessing files already ingested even if the same file is uploaded multiple times. EDI transaction sets, 850 (purchase order), 810 (invoice), 856 (advance ship notice), 997 (functional acknowledgement), parsed with an X12 EDI library and transformed to JSON before downstream routing. XML exports from proprietary ERPs validated against XSD schema before processing, malformed XML rejects with a specific validation error rather than parsing with silent field omission. Integration health monitoring per data source: last successful file received timestamp, file count and row count per batch (deviation from expected range triggers alert), record acceptance rate, and per-field null rate tracking to detect when a source system starts exporting empty values for previously-populated fields.