LibreChat/api/server/routes/__tests__
Danny Avila dd35f42073
🔒 feat: Idempotency Check for OAuth Flow Completion (#10468)
* 🔒 feat: Implement idempotency check for OAuth flow completion

- Added a check to prevent duplicate token exchanges if the OAuth flow has already been completed.
- Updated the OAuth callback route to redirect appropriately when a completed flow is detected.
- Refactored token storage logic to use original flow state credentials instead of updated ones.
- Enhanced tests to cover the new idempotency behavior and ensure correct handling of OAuth flow states.

* chore: add back scope for logging

* refactor: Add isFlowStale method to FlowStateManager for stale flow detection

- Implemented a new method to check if a flow is stale based on its age and status.
- Updated MCPConnectionFactory to utilize the isFlowStale method for cleaning up stale OAuth flows.
- Enhanced logging to provide more informative messages regarding flow status and age during cleanup.

* test: Add unit tests for isFlowStale method in FlowStateManager

- Implemented comprehensive tests for the isFlowStale method to verify its behavior across various flow statuses (PENDING, COMPLETED, FAILED) and age thresholds.
- Ensured correct handling of edge cases, including flows with missing timestamps and custom stale thresholds.
- Enhanced test coverage to validate the logic for determining flow staleness based on createdAt, completedAt, and failedAt timestamps.
2025-11-12 08:44:45 -05:00
..
config.spec.js 🔑 feat: SAML authentication (#6169) 2025-05-29 11:00:58 -04:00
convos.spec.js 🗑️ fix: Delete Shared Links on Conversation Deletion (#10396) 2025-11-06 11:44:28 -05:00
ldap.spec.js 🧹 chore: Cleanup Logger and Utility Imports (#9935) 2025-10-01 23:30:47 -04:00
mcp.spec.js 🔒 feat: Idempotency Check for OAuth Flow Completion (#10468) 2025-11-12 08:44:45 -05:00
static.spec.js 🗂️ fix: Disable express-static-gzip for Uploaded Images (#8307) 2025-07-11 16:51:53 -04:00