fix: add /api/agentic/authorize to BACKEND_ONLY_ROUTES#51161
Closed
fix: add /api/agentic/authorize to BACKEND_ONLY_ROUTES#51161
Conversation
When a user isn't logged into PostHog and Stripe opens the agentic authorize URL, Django's @login_required redirects to /login?next=... After login, the React SPA router intercepts the next URL and handles it client-side instead of navigating to the Django backend endpoint. This causes the OAuth flow to silently fail. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Size Change: +181 B (0%) Total Size: 109 MB ℹ️ View Unchanged
|
Contributor
Author
|
Closing - tested this scenario and the login redirect already works correctly without this change. |
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.
Problem
When a user isn't logged into PostHog and Stripe opens the
/api/agentic/authorizeURL, Django's@login_requireddecorator redirects to/login?next=/api/agentic/authorize.... After the user logs in, the React SPA router intercepts thenextURL and tries to handle it client-side instead of performing a full-page navigation to the Django backend endpoint. This causes the Stripe agentic provisioning OAuth flow to silently fail.Changes
Added
/api/agentic/authorizeto theBACKEND_ONLY_ROUTESarray infrontend/src/scenes/authentication/loginLogic.ts. This tells the post-login redirect handler to usewindow.location.href(full-page navigation) instead of the React router for this route, ensuring the request reaches the Django backend.How did you test this code?
This was authored by an agent. No manual testing was performed. To test manually:
/api/agentic/authorize?...(with valid Stripe OAuth params)/login?next=/api/agentic/authorize.../api/agentic/authorize(Django handles it) instead of the React SPA swallowing the routePublish to changelog?
No
Docs update
N/A
🤖 LLM context
Co-authored with Claude Code (Opus 4.6).