Skip to content

fix(web): ask for the two-factor code when signing in for the app - #762

Merged
Medformatik merged 1 commit into
mainfrom
fix/mobile-auth-two-factor
Nov 3, 2026
Merged

Medformatik merged 1 commit into
mainfrom
fix/mobile-auth-two-factor

Conversation

@Medformatik

Copy link
Copy Markdown
Collaborator

What changed and why

Signing in to the installed app with an account that has two-factor sign-in enabled never reached the code step. After the email and password, the system browser showed the password form again.

The app's sign-in page (/mobile-auth) rendered the sign-in dialog only while the session was not pending. better-auth reports every refetch of an empty session as pending, and the password step triggers one right before it asks for the two-factor code. The dialog unmounted during that refetch and came back on its password form, so its switch to the code step was lost. The main web page does not gate its dialog this way, so web sign-in was unaffected.

Now only the first session check hides the dialog; later refetches leave it mounted.

Verification

  • Web vitest for apps/web/src/app/mobile-auth and AuthDialog: 25 passed. The new test fails without the fix: the dialog disappears when the signed-out session goes pending.
  • tsc for apps/web, biome.
  • Reported on a Pixel (Android 17) with a release build of the app against openmapx.com: email and password returned to the password form. Not yet checked on the device with the fix, because that needs this change deployed to openmapx.com.

Release and upgrade impact

Product impact: ordinary

The app's sign-in page rendered the sign-in dialog only while the session
was not pending. better-auth reports every refetch of an empty session as
pending, and the password step triggers one right before it asks for the
two-factor code, so the dialog unmounted and came back on its password
form. An account with two-factor sign-in could never get past it.

Only the first session check now hides the dialog.
@Medformatik
Medformatik merged commit 707864e into main Nov 3, 2026
23 checks passed
@Medformatik
Medformatik deleted the fix/mobile-auth-two-factor branch November 3, 2026 23:50
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant