Add Logout logic and Remove Sample Curl in Proxy - #3081
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughThe AI workspace now centralizes authenticated 401 handling across platform, Choreo, and organization API requests. The logout flow prevents duplicate forced redirects. The proxy overview no longer renders the generated API-key cURL snippet. ChangesAuthentication and API error handling
Proxy overview cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant APIRequest
participant handleUnauthorizedResponse
participant forceLogoutAndRedirect
APIRequest->>handleUnauthorizedResponse: process failed response
handleUnauthorizedResponse->>forceLogoutAndRedirect: start once for 401
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
issue: #3092 |
This pull request introduces a centralized and consistent mechanism for handling unauthorized API responses (HTTP 401) throughout the application. It adds a new
handleUnauthorizedResponseutility to trigger a single logout and redirect flow when a session expires, and integrates this handler into all major API layers. Additionally, it removes unused code related to LLM providers from theLLMProxyOverviewTabcomponent.Session Management and API Error Handling:
handleUnauthorizedResponsefunction inlogout.tsthat ensures only one forced logout/redirect occurs when multiple API calls return 401 due to session expiry. This prevents duplicate logout attempts and competing redirects.handleUnauthorizedResponseinto all major API clients and context fetchers (platformApis.ts,choreoApiClient.ts,ChoreoUserContext.tsx) so that unauthorized responses consistently trigger the session-expiry flow. [1] [2] [3] [4] [5] [6] [7]Code Cleanup and Refactoring:
clearStoredTokencall fromclearAuthDatainlogout.ts, as it is no longer needed.LLMProxyOverviewTabcomponent by removing unused imports and logic related to LLM provider templates and theApiTryOutCurlSnippetcomponent, simplifying the component and reducing unnecessary dependencies. [1] [2] [3] [4] [5]