Conversation
|
WalkthroughSDK initialization now calls getApiBaseUrl with only currentUrl (removed allowLocalhost and preserveSubdomain options). The auth provider now conditionally persists the JWT to localStorage when the resolved API base URL hostname is "localhost" after login (both OTP and non-OTP paths) and removes it on logout; getApiBaseUrl was imported. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AuthProvider
participant SDK
participant Core as getApiBaseUrl
participant Storage as localStorage
User->>AuthProvider: login(credentials) -- OTP or non-OTP path
AuthProvider->>SDK: authenticate(...)
SDK-->>AuthProvider: token
AuthProvider->>SDK: setAuthToken(token)
AuthProvider->>Core: getApiBaseUrl()
Core-->>AuthProvider: baseUrl
alt baseUrl.hostname == "localhost"
AuthProvider->>Storage: setItem("jwt", token)
end
AuthProvider-->>User: login success
sequenceDiagram
participant User
participant AuthProvider
participant Backend
participant Core as getApiBaseUrl
participant Storage as localStorage
User->>AuthProvider: logout()
AuthProvider->>Backend: POST /logout
Backend-->>AuthProvider: success
AuthProvider->>Core: getApiBaseUrl()
Core-->>AuthProvider: baseUrl
alt baseUrl.hostname == "localhost"
AuthProvider->>Storage: removeItem("jwt")
end
AuthProvider-->>User: logout complete
sequenceDiagram
participant App
participant Capability
participant Core as getApiBaseUrl
participant SDK
App->>Capability: initialize(currentUrl)
Capability->>Core: getApiBaseUrl(currentUrl)
Core-->>Capability: apiUrl | false
alt apiUrl
Capability->>SDK: new Sdk(apiUrl)
SDK-->>Capability: instance
else invalid
Capability-->>App: throw "Invalid API URL configuration"
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libs/portal-framework-auth/src/capabilities/sdk.ts(0 hunks)libs/portal-framework-auth/src/dataProviders/auth.ts(2 hunks)
💤 Files with no reviewable changes (1)
- libs/portal-framework-auth/src/capabilities/sdk.ts
🧰 Additional context used
🧬 Code Graph Analysis (1)
libs/portal-framework-auth/src/dataProviders/auth.ts (1)
libs/portal-framework-core/src/index.ts (1)
getApiBaseUrl(58-58)
🔇 Additional comments (1)
libs/portal-framework-auth/src/dataProviders/auth.ts (1)
13-14: Import looks correct and aligns with intended usageBringing
getApiBaseUrlinto this module is appropriate for gating localhost-only persistence. The return type (string | undefined) matches how you guard its usage later.
…calhost JWT storage - Remove redundant API URL configuration options in Capability class - Add local JWT storage for localhost development in auth provider - Ensure consistent API base URL usage across auth flows
5a4608b to
018015b
Compare
Summary by CodeRabbit
New Features
Bug Fixes