Add missing auth middleware to api-nango and api-subscription routers#3732
Closed
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Closed
Add missing auth middleware to api-nango and api-subscription routers#3732devin-ai-integration[bot] wants to merge 3 commits intomainfrom
devin-ai-integration[bot] wants to merge 3 commits intomainfrom
Conversation
- Extract shared env config types (SupabaseEnv, NangoEnv) into new api-env crate - Introduce AuthContext in api-auth middleware, removing duplicated extract_token helpers across crates - Move calendar routes and nango_http from api-nango to api-calendar where they belong - Add list_calendars and create_event endpoints to api-calendar - Replace hardcoded NangoIntegration enum with fluent client.integration().connection() API - Simplify config constructors to accept env structs directly Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: yujonglee <yujonglee.dev@gmail.com>
Base automatically changed from
refactor/api-auth-calendar-separation
to
main
February 8, 2026 07:52
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.
Add missing auth middleware to api-nango and api-subscription routers
Summary
Fixes two bugs identified by Devin Review on PR #3728: handlers in
api-nangoandapi-subscriptionwere refactored to extractExtension<AuthContext>, but the routers were never updated to apply therequire_authmiddleware that inserts it. Without this fix, every request to these endpoints returns 500 Internal Server Error ("Missing request extension").Changes per crate:
api-nango: Addedsupabase_urltoIntegrationConfig(breaking signature change to::new()), addedauth: AuthStatetoAppState, and appliedroute_layerwithrequire_authonly to/connect-session(not/webhook, which uses its own HMAC signature auth).api-subscription: Addedauth: AuthStatetoAppState, appliedroute_layerwithrequire_authto all routes (/can-start-trial,/start-trial).Follows the same pattern already used in
api-calendar/src/routes/mod.rs.Review & Testing Checklist for Human
tauri-plugin-cli2,tauri-plugin-db,tauri-plugin-export) that are artifacts from temporary build stubs — these should be reverted/dropped before merging.route_layerordering in api-nango router: Verify that placingroute_layerbetween the/connect-sessionand/webhookroute definitions correctly applies auth only to/connect-session. In axum,route_layerapplies to previously-defined routes, so this should be correct — but worth a quick sanity check.IntegrationConfig::newsignature change: Now requires a third&SupabaseEnvargument. Confirm that all call sites (likely in the API server or integration tests that wire up these configs) are updated accordingly./connect-sessionreturns 401 without a token and 200 with a valid token, (2)/webhookstill works with HMAC auth and does NOT require a Bearer token, (3)/can-start-trialand/start-trialreturn 401 without a token.Notes