Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2528 +/- ##
==========================================
+ Coverage 90.15% 90.53% +0.38%
==========================================
Files 51 52 +1
Lines 6439 6638 +199
Branches 1292 1387 +95
==========================================
+ Hits 5805 6010 +205
+ Misses 623 617 -6
Partials 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
63314d1 to
d87cac3
Compare
d87cac3 to
fa093f5
Compare
| * | ||
| * If it's not specified, it will be loaded from the `APP_BASE_URL` environment variable. | ||
| * If neither is provided, the SDK will infer it from the request host at runtime. | ||
| * When using multiple dynamic environments, pass an array or a comma-separated list. |
There was a problem hiding this comment.
| * When using multiple dynamic environments, pass an array or a comma-separated list. | |
| * When you have the need to support multiple base URL's, and you know the values on start-up (e.g. environment variables), we do recommend configuring all the allowed base URL's in `appBaseUrl`. Doing this ensures we do not unnecessarily redirect the user to Auth0 when the host is not an allowed value. |
| const appBaseUrls = normalizeAppBaseUrlConfig(appBaseUrl); | ||
|
|
||
| if (appBaseUrls) { | ||
| const allHttps = appBaseUrls.every( |
There was a problem hiding this comment.
Can we rename this to something more descriptive (e.g. allBaseUrlsUseHttps)
| (url) => new URL(url).protocol === "https:" | ||
| ); | ||
|
|
||
| if (allHttps) { |
There was a problem hiding this comment.
Can we add a comment on why we do this:
Only when all APP_BASE_URLS provided are using https, we will default ensure the cookies are secure. In all other cases we rely on what the user has set.
| sessionCookieOptions.secure = true; | ||
| transactionCookieOptions.secure = true; | ||
| } | ||
| } else if (process.env.NODE_ENV === "production") { |
There was a problem hiding this comment.
Let's add some comment to clearly say that when we do not have an appBaseUrl provided, and we are relying on the dynamic request url resolution, we require secure flag to be set.
This PR refines dynamic base URL handling for preview environments such as
VercelandNetlify. The SDK now clearly documents allow‑list recommendations, enforces secure cookies in production whenappBaseUrlis omitted, and includes full unit coverage for the base‑URL helper logic.Changes
appBaseUrlnow supports list of base urls.appBaseUrlis nowoptional.onCallBackContextnow hasappBaseUrlproperty.Usage example
Allow‑list (recommended for preview deployments):
Zero‑config host inference (optional):
Note
appBaseUrlis omitted in production, cookies are forced securesecure=falsewill throwInvalidConfigurationError.