Repository navigation
fix(web): ask for the two-factor code when signing in for the app - #762
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
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
apps/web/src/app/mobile-authandAuthDialog: 25 passed. The new test fails without the fix: the dialog disappears when the signed-out session goes pending.tscforapps/web, biome.Release and upgrade impact
Product impact: ordinary