Conversation
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
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ 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 |
Fix social login localhost fallback via relative API routing and resolve OAuth redirect loops (vertex app)
…-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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.