Skip to content

web/flows: never let continuous login block the final redirect - #26269

Merged
GirlBossRush merged 11 commits into
goauthentik:mainfrom
dpitts03:continuous-login-never-block-redirect
Oct 27, 2026
Merged

GirlBossRush merged 11 commits into
goauthentik:mainfrom
dpitts03:continuous-login-never-block-redirect

Conversation

@dpitts03

@dpitts03 dpitts03 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Details

The final redirect awaits continuous-login orchestration and the exit bookkeeping before navigating, so any error or hang there leaves the page on the spinner after the server has already finished the flow. In Google's Android account setup WebView, localStorage is null and the orchestrator throws (#23660, #26267).


Edited by maintainer

This PR ensures continuous-login orchestration can never keep a completed flow from redirecting, and elects the resume leader with the Web Locks API. Continuous login is skipped where navigator.locks is unavailable (insecure contexts such as plain HTTP). The tab still redirects normally.

  • Catch and log orchestration errors in RedirectStage, then always navigate.
  • Replace the localStorage leader lock with navigator.locks.request(..., { ifAvailable: true }). The browser releases the lock when the leader settles, navigates, or closes.
  • Drops the lock-liveness check (tabs.has(lockTabID)) and the manual lock cleanup.
  • Return a copy from discoverTabs(). Rediscovery mutated the live Set the leader was iterating, resuming a lingering follower forever.
  • Resolves the follower wait when rediscovery rejects in the timer callback.
  • Adds a two-tab Playwright e2e test for multi-tab resume.
  • Waits in the e2e test for each tab to render with the flag enabled, since system settings are cached per server process.
  • Moves the server-context <meta> and json_script readers into @goauthentik/core/document, shared by the main bundle and the SFE.
  • Adds an injectBrand test helper with a default brand, replacing the per-file brand setup.

Closes #23660, closes #26267. Supersedes #25692.

@dpitts03
dpitts03 requested a review from a team as a code owner September 18, 2026 15:12
@BeryJu BeryJu changed the title never let continuous login block the final redirect web/flows: never let continuous login block the final redirect Sep 18, 2026
@netlify

netlify Bot commented Sep 18, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit b4d87f2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6aad54d9f37b7f0008d62651
😎 Deploy Preview https://deploy-preview-26269--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mo74m3ed

Copy link
Copy Markdown

The final redirect awaits continuous-login orchestration and the exit bookkeeping before navigating, so any error or hang there leaves the page on the spinner after the server has already finished the flow. In Google's Android account setup WebView, localStorage is null and the orchestrator throws (#23660, #26267).

  • Catch and log orchestration errors in RedirectStage, then always navigate.

  • Return a copy from discoverTabs(). waitForTabExit() rediscovers while the leader iterates the live Set, and entries re-added during for...of are visited again, so a follower that never exits was resumed forever.

  • Resolve the wait when rediscovery rejects in the timer callback, and release the tab lock in a finally block.

Details

What does this PR change?

Why is this change needed?

How was this tested?

Linked issues


Checklist

  • The project has been linted, built, and tested (make all)

  • The documentation has been updated and formatted (make docs)

  • I have read the AI usage policy.

@GirlBossRush
GirlBossRush force-pushed the continuous-login-never-block-redirect branch 2 times, most recently from d2ec63a to fab11ea Compare October 27, 2026 14:23
@codecov

codecov Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.40%. Comparing base (a1e049b) to head (ce2bbe1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #26269      +/-   ##
==========================================
- Coverage   92.43%   92.40%   -0.04%     
==========================================
  Files        1193     1193              
  Lines       80838    80838              
  Branches     4497     4497              
==========================================
- Hits        74722    74696      -26     
- Misses       6050     6076      +26     
  Partials       66       66              
Flag Coverage Δ
conformance 32.23% <ø> (+<0.01%) ⬆️
e2e 36.89% <ø> (+<0.01%) ⬆️
integration 28.77% <ø> (-0.35%) ⬇️
rust 45.98% <ø> (ø)
unit 94.08% <ø> (+<0.01%) ⬆️
unit-migrate 94.08% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

dpitts03 and others added 11 commits October 27, 2026 16:58
The final redirect awaits continuous-login orchestration and the exit
bookkeeping before navigating, so any error or hang there leaves the
page on the spinner after the server has already finished the flow.
In Google's Android account setup WebView, localStorage is null and
the orchestrator throws (goauthentik#23660, goauthentik#26267).

- Catch and log orchestration errors in RedirectStage, then always
  navigate.
- Return a copy from discoverTabs(). waitForTabExit() rediscovers
  while the leader iterates the live Set, and entries re-added during
  for...of are visited again, so a follower that never exits was
  resumed forever.
- Resolve the wait when rediscovery rejects in the timer callback, and
  release the tab lock in a finally block.
Replace the hand-rolled localStorage lock — a non-atomic check-then-set
guarded by a tab-liveness heuristic — with navigator.locks. `ifAvailable`
gives immediate leader election with no double-leader race, and the
browser releases the lock on navigation or close, so there is no stale
lock to reap and no manual cleanup.
Drive two real tabs in one browser context: authenticate in the leader
and assert the follower leaves the identification stage on its own. The
global flag is enabled in beforeAll and restored in afterAll; the file
carries the highest numeric prefix and runs serially so it does not race
the parallel login suite.
Move the global-flag toggle into an e2e/ helper (setInstanceFlag) so the
test stops hand-constructing fixtures inline, and confirm the settings
save through its success toast instead of matching the settings network
response — keeping the flow on the UI like the rest of the suite.
@GirlBossRush
GirlBossRush force-pushed the continuous-login-never-block-redirect branch from beab5de to ce2bbe1 Compare October 27, 2026 16:58
@GirlBossRush
GirlBossRush merged commit 5def7a7 into goauthentik:main Oct 27, 2026
163 checks passed
kensternberg-authentik added a commit that referenced this pull request Nov 5, 2026
* main: (89 commits)
  providers/scim: scope-aware adoption (#26174)
  sources/ldap: respect accountExpires attributes (#26135)
  web/flows: never let continuous login block the final redirect (#26269)
  website: document password hash import restrictions (#24235)
  core: restrict imported password hashers (#24234)
  core, web: update translations (#27148)
  server: retry requests on connections closed by a recycled worker (#27275)
  packages/django-postgres-cache, flows: count cache keys in the database (#25808)
  events: simplify execution of event rules/notifications (#26873)
  core: bump github.com/pires/go-proxyproto from 0.15.0 to 0.16.0 (#27260)
  core: bump goauthentik/platform-ssh from 26.04-ak-0.72.3 to 26.04-ak-0.72.4 in /tests/e2e (#27263)
  core: bump goauthentik/selenium from 155.0-ak-0.72.3 to 155.0-ak-0.72.4 in /tests/e2e (#27261)
  core: bump astral-sh/uv from 0.13.5 to 0.13.6 in /lifecycle/container (#27264)
  core: bump jsonpatch from 1.35 to 1.36 (#27269)
  outposts: refresh channel groups on hello (#27136)
  core: bump certifi from 2026.10.19 to 2026.10.23 (#27266)
  core: bump pluggy from 1.6.0 to v1.7.0 (#27238)
  core: bump markupsafe from 3.0.3 to v3.0.4 (#27225)
  core: bump httptools from 0.8.0 to v0.9.0 (#27219)
  core: bump iniconfig from 2.3.0 to v2.3.1 (#27221)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sign-in hangs on the loading spinner in Android's "Add Google Workspace account"

3 participants