Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): Entra sign-in offers passkeys in the preview browser #30018

Closedcveld(GitHub profile, opens in a new tab)wants to merge 6 commits intomain fromrefs/pull/30018/headopened View on GitHub

Problem

Entra sign-in hides the passkey option in the desktop preview browser. The request User-Agent contains an Electron/<version> token, and Entra then stops offering passkeys even though the embedded Chromium supports WebAuthn and platform authenticators (Windows Hello, and 1Password as Windows plugin passkey provider). Details and measurements are in https://git.cafe/pingdotgg/t3code/issues/30014.

Change

BrowserSession registers a webRequest.onBeforeSendHeaders listener, scoped to login.microsoftonline.com, login.microsoft.com and login.live.com, that removes the Electron/<version> token from the User-Agent request header. Nothing else changes:

Scope and approval

This is a behavior change, so it needs maintainer direction. https://git.cafe/pingdotgg/t3code/issues/30014 is the bug report; it has not been triaged yet, so there is no maintainer approval to link at the time of writing. I opened this as a small, host-scoped change so the direction can be judged against concrete code, and I will rework or close it if the maintainers prefer a different approach (for example a per-profile setting, as discussed in https://git.cafe/pingdotgg/t3code/issues/22444).

Verification

  • vp test run src/preview/BrowserSession.test.ts in apps/desktop: 10 of 10 pass, including two new tests: one for the token stripping (with and without a token present) and one that the listener is registered for exactly the three Microsoft hosts, handles User-Agent and user-agent header keys, and leaves the original headers object untouched.
  • vp fmt --check and vp lint on the two changed files, plus the pre-commit knip:check.
  • Manual A/B test on Windows 11 in a dev build (Electron 44.10.0, same build, same account, 1Password as passkey provider), with the rewrite toggled off and on:
    • rewrite off: Entra shows no passkey option
    • rewrite on: Entra shows the passkey option and sign-in works
    • navigator.userAgent in the page was identical in both runs.

What I could not check:

  • I did not capture the outgoing header on the wire; the effect is inferred from the behavior change.
  • I do not know whether Electron/ is the only trigger Entra looks at, or whether the app token matters too.
  • Only Windows was tested. macOS and Linux were not.

I also asked Microsoft whether this Entra behavior is intended: https://learn.microsoft.com/en-us/answers/questions/6059339/entra-sign-in-does-not-offer-passkeys-when-the-use

Closes https://git.cafe/pingdotgg/t3code/issues/30014

Model and harness: Claude Sonnet 5.5 via Claude Code.

🤖 Generated with Claude Code

Fixes pingdotgg/t3code#30014

    1. Pushed05f3eeb

    2. cveld(GitHub profile, opens in a new tab)commented

      Windows 11 proof: Entra offers a passkey with this change, not without it

      Run by me on a real Windows 11 machine, which is the case the automated pipeline could not cover.

      Environment

      • Windows 11 25H2, build 26200.9911
      • Electron 44.10.0 (Authenticode-signed copy for the branch build)
      • Passkey provider: 1Password, through the Windows passkey dialog
      • Entra work account with a registered passkey; address, name and tenant are blurred in the recordings
      • Same machine, same account, same Chromium profile for both runs

      A/B

      BuildWhat the preview browser shows on login.microsoftonline.com
      Without the rewrite (the installed release build, T3 Code (Beta) 0.1.7), recording A"Verify your identity" lists only "Approve a request on my Microsoft Authenticator app", "Approve a request on my Outlook mobile app" and "Use a verification code". No passkey option.
      This branch (05f3eebb4f, merged with current main), recording BAfter choosing the account, Entra opens "Face, fingerprint, PIN or security key" and Windows opens its passkey dialog ("Aanmelden met een wachtwoordsleutel"), and the sign-in completes in Microsoft Copilot.

      Recording A (without the rewrite):

      https://github.com/user-attachments/assets/4824949f-a849-4b4d-9201-110d689dcf87

      Recording B (with this branch):

      https://github.com/user-attachments/assets/ddcbecb3-087b-49a4-beca-539dab358eef

      Recording B goes from the account picker straight to the passkey page, so it does not show the method list itself; recording A shows that list without a passkey entry. In recording B the sign-in then completes: after the passkey dialog the preview browser lands on Microsoft Copilot (copilot.cloud.microsoft), signed in.

      Not verified: macOS and Linux authenticators, and whether Electron/ is the only token Entra looks at.

      I also pushed 05f3eebb4f to this branch: it merges current main to clear the conflict, and isTeamsUrl becomes isElectronTokenStrippedUrl. The intent is unchanged: Electron/<version> is removed from the User-Agent request header only for Teams and the three Microsoft sign-in hosts (login.microsoftonline.com, login.microsoft.com, login.live.com), inside the single shared onBeforeSendHeaders listener on main. navigator.userAgent and all other hosts keep the native value.

    3. Thanks for this. Main has the change since #45049.

      Compared your BrowserSession.ts and BrowserSession.test.ts diff with the merged change: main now removes Electron/ for all preview requests, including all three Microsoft sign-in hosts your patch covers, and keeps page and worker identities consistent.

      Closing as superseded.

    4. juliusmarminge closed this

Sign in to join this conversation.