feat(auth): Auto-redirect authenticated users on auth pages via BroadcastChannel #107390
+53
−0
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.
Summary
When users have multiple tabs open on auth pages and log in on one tab, other tabs still show the login form. This PR adds BroadcastChannel-based cross-tab communication to auto-redirect authenticated users.
organizations:auth-broadcast-channel-redirectfeature flag for gradual rolloutThis complements the CSRF token sync fix (#107389) for multi-tab scenarios.
Browser Support
BroadcastChannel is supported in Chrome 54+, Firefox 38+, Safari 15.4+, Edge 79+. Falls back gracefully (visibility change or CSRF sync) on older browsers.
Test Plan
/auth/login/{org}/Files Changed
src/sentry/features/temporary.py- Add feature flagsrc/sentry/web/frontend/auth_organization_login.py- Pass feature flag to template contextsrc/sentry/templates/sentry/organization-login.html- Expose config to JavaScriptsrc/sentry/templates/sentry/bases/auth.html- Add BroadcastChannel listener + visibility fallbackstatic/app/views/auth/loginForm.tsx- Broadcast login event on success