Skip to content

move to production#3608

Merged
Baalmart merged 24 commits into
masterfrom
staging
Jun 9, 2026
Merged

move to production#3608
Baalmart merged 24 commits into
masterfrom
staging

Conversation

github-actions Bot and others added 18 commits June 9, 2026 17:06
Introduce src/vertex/lib/api-routing.ts with buildServerApiUrl and buildBrowserApiUrl to centralize how server- and browser-side API URLs are built (avoids split-brain env issues). Replace scattered getApiBaseUrl usage across auth options, oauth session, users API, network service, and proxy client to use the new builders. Tighten env constants: getApiBaseUrl now requires NEXT_PUBLIC_API_URL (throws if missing) and getEnvironment was moved/renamed. Update vertex.config to use getApiBaseUrl. Misc: adjust variable names in proxy client (API_URL) and ensure browser requests use relative /api/v2 paths.
Switch OAuth initiation to use buildServerApiUrl instead of buildBrowserApiUrl to construct the /users/auth/:provider endpoint. Also adjust proxy path handling to strip a leading "v2/" (and treat "v2" as empty) so requests don't end up with a double /v2/ segment when getApiBaseUrl() already includes it.
Improve OAuth handling across auth flow:

- options.ts: increase profile fetch timeout to 10s, normalize the OAuth access token and only send Authorization when present, include credentials in the fetch, and return null on AbortError to avoid logging noise.
- social-auth-section.tsx: append a success=<provider> query param to redirect_after URLs so callers can detect successful social sign-ins.
- authProvider.tsx: force NextAuth SessionProvider to update after token handoff (await update()), watch session status to clear the isHandlingOAuth flag when authenticated, ensure the flag is cleared on error branches, and adjust bootstrap blocking logic to wait for NextAuth to flush its authenticated state before unblocking.

These changes make token handoff more robust and ensure redirects and session state are synchronized correctly.
Return null from SocialAuthSection when NEXT_PUBLIC_API_URL is not set. This avoids runtime crashes during OAuth initiation when getApiBaseUrl() would throw due to a missing API URL environment variable.
Provide window.location.origin as the base when constructing the URL from redirectAfter so relative paths are resolved correctly. This prevents errors from the URL constructor for relative redirectAfter values and ensures the success query param and redirect_after value are set to a full URL.
Switch oauth-session to use buildBrowserApiUrl for constructing the OAuth initiation URL (client-side) instead of buildServerApiUrl. Remove the environment-var guard in SocialAuthSection that hid social auth when NEXT_PUBLIC_API_URL was missing so social buttons render even if that env var isn't present. This change prevents unnecessary hiding and avoids runtime issues during OAuth initiation by using the browser API URL builder.

Files changed: src/vertex/core/auth/oauth-session.ts, src/vertex/components/features/auth/social-auth-section.tsx.
Hide the social auth UI when NEXT_PUBLIC_API_URL is not set to avoid runtime crashes during OAuth initiation. Also switch oauth-session to use buildServerApiUrl when constructing the /users/auth/:provider initiation URL to ensure the API base is built appropriately. Changes touch social-auth-section.tsx and oauth-session.ts.
…ta caution

The cohort workaround said "device identifiers" which could be read as
device_id; the Analytics API takes device_names. Updated to name the exact
field returned by the Metadata generate endpoint and the exact parameter
to pass in the Analytics request.
Allow the client to fully handle OAuth callbacks and preserve provider/redirect info.

- Middleware: always return authorized so the client-side AuthWrapper enforces protection. This is required because OAuth uses URL hash fragments (e.g. #token=...) which server-side middleware cannot read; blocking here could strip callbacks and cause redirect loops.
- Social auth: stop building a new URL and appending a success param; pass redirectAfter through as provided (redirect_after = redirectAfter).
- OAuth session: if the provider is missing in the handoff, fall back to getLastUsedOAuthProvider() so provider info is retained when possible.

These changes ensure OAuth flows and redirects are handled correctly on the client and that provider information is preserved.
Fix historical data overviews to direct users to Metadata API for ID discovery
@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f1ce28f5-a34e-4137-bae1-ff84dca57662

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch staging

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

github-actions Bot and others added 2 commits June 9, 2026 22:27
Fix social login localhost fallback via relative API routing and resolve OAuth redirect loops (vertex app)
@Baalmart
Baalmart requested a review from Codebmk June 9, 2026 19:41
Baalmart and others added 4 commits June 9, 2026 22:42
…-access guides

Replaced all info@airqo.net references with support@airqo.net in both
researchers-guide.md and fair-usage-policy.md so the contact email is
consistent throughout — support@airqo.net is the inbox monitored by the
technical team.
Add researcher guide and fair usage policy as new data-access docs section
@Baalmart
Baalmart merged commit 67534ea into master Jun 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants