Skip to content

fix: yield to the user on federated login pages instead of thrashing#12

Open
enieuwy wants to merge 1 commit into
Rimagination:mainfrom
enieuwy:fix/login-loop-yield
Open

fix: yield to the user on federated login pages instead of thrashing#12
enieuwy wants to merge 1 commit into
Rimagination:mainfrom
enieuwy:fix/login-loop-yield

Conversation

@enieuwy

@enieuwy enieuwy commented Jun 29, 2026

Copy link
Copy Markdown

Problem

During the visible-browser manual-login wait, _complete_login_from_current_page re-clicks the SSO/OpenAthens entry controls every ~3s unless _is_human_login_page() returns True. That detector only recognized Chinese-academia hosts (.edu.cn, .ac.cn, ...), so on login.openathens.net (and other non-CN IdPs) it returned False and the loop kept navigating the page on a 3s cycle. The user could never type their institution/credentials — the page visibly flickered between 'Forgotten your password?' and 'Sign in with your institution'.

This makes interactive institutional login impossible for OpenAthens / AAF (Australia) / UK / etc. users.

Fix

Recognize real login/IdP pages so the loop yields:

  • Federated-access hubs: openathens.net, seamlessaccess.org.
  • Common identity providers: Azure AD (microsoftonline.com), Okta, Auth0, Duo, Ping.
  • International academic host suffixes: .edu.au, .ac.uk, .ac.nz, .edu.sg, .ac.jp, .ac.za, .ac.in, .edu.in, .ac.kr, .edu.my.

The automation never fills credentials, so treating any real login/IdP page as 'wait' is safe; publisher pages are unaffected and still get the SSO-entry click.

Verified live

With this fix, instsci publisher-batch against a Wiley DOI completed a real University of New England OpenAthens login in the visible browser and captured the verified PDF (Done: 1/1 verified PDFs). Before the fix the same flow was unusable (page thrashing).

Tests

tests/test_human_login_page.py: OpenAthens / SeamlessAccess / Azure AD / Duo / AU + UK university IdPs are treated as human-login; publisher article pages are not.

Based on main.

During the manual-login wait, _complete_login_from_current_page re-clicks the
SSO/OpenAthens entries every 3s unless _is_human_login_page() returns True.
That detector only recognized Chinese-academia hosts (.edu.cn etc.), so on
login.openathens.net it kept returning False -> the loop navigated the page
on a 3s cycle and the user could never enter their institution/credentials.

Recognize federated-access hubs (OpenAthens, SeamlessAccess) and common IdP
providers (Azure AD, Okta, Auth0, Duo, Ping) as human-login pages, and add
international academic host suffixes (.edu.au, .ac.uk, .ac.nz, .edu.sg, ...).
The automation never fills credentials, so treating any real login/IdP page
as 'wait' is safe; publisher pages are unaffected and still get the SSO-entry
click.

Adds a unit test covering OpenAthens/SeamlessAccess/Azure/Duo/AU+UK IdPs as
human-login and publisher pages as not.
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.

1 participant