Cannot authenticate with yubikey when verifying new email

AI-generated summary

Users reported a bug where authenticating with a YubiKey during email verification redirects to a blank page or fails with a 400 error, while TOTP works fine. The issue was initially observed by Wolftallemo and confirmed by Falco and others. Initial investigation revealed JavaScript errors caused by I18n being loaded too late dan. After a fix was deployed, Falco reported a new error in Firefox — a DOMException during WebAuthn credential retrieval — and noted a UI issue with button color in dark mode. dan confirmed the fix worked in Chrome with YubiKey 5 NFC and macOS Touch ID. Falco specified using Firefox with the same YubiKey. The issue was ultimately resolved by dan via commit f1b97202, which addressed the WebAuthn failure in Firefox.

When I try changing my primary email, when I attempt to authenticate with my yubikey, I am sent to a blank page, whereas if I try with totp it works.

Trying to authenticate with a yubikey sends me to https://example.com/u/confirm-new-email/ instead of the yubikey authentication page (or it is the correct url and it’s not displaying?)

3 Likes

Have you tried doing the same thing here on meta?

I got the same exact result

Can we repro this @tshenry?

1 Like

Same thing happened to me. Trying to use webauthn fails with a POST returning 400. Falling back to TOTP works, so it’s only reproducible on webauthn path.

4 Likes

OK, we should assign this bug @sam

2 Likes

There were some JavaScript errors which stopped script loading. The errors were caused by I18n being loaded after it was used.

https://github.com/discourse/discourse/commit/111877db1f97271d667bdd05139c798cf7fd26d2

9 Likes

Can you confirm this is now good on meta @falco?

5 Likes

Still very broken, but with a different error:

When I click on the button I get an exception on the console:

Uncaught DOMException: String contains an invalid character _webauthn-79591e16a85801db9750996c5c059c632687959ec31675c66471d17c31cf077c.js:1
    a _webauthn-79591e16a85801db9750996c5c059c632687959ec31675c66471d17c31cf077c.js:49
    map self-hosted:240
    getWebauthnCredential _webauthn-79591e16a85801db9750996c5c059c632687959ec31675c66471d17c31cf077c.js:47
    onclick _confirm-new-email-bdb5d7a6ac7e878466fcb1dfe7263d6e00441cce01b43f225baeb0a5d475db55.js:8
    (Async: EventHandlerNonNull)
    <anonymous> _confirm-new-email-bdb5d7a6ac7e878466fcb1dfe7263d6e00441cce01b43f225baeb0a5d475db55.js:5
    jQuery 3
    <anonymous> _bootstrap-52b6b6b3fa62d64b09775e2803255326bef3a94a16063a8c191a37e0909f59d1.js:3

Also wrong color the the button in dark mode:

5 Likes

What browser and security key are you using? I just tested this here, with YubiKey 5 NFC and Chrome on Linux and MacBook Pro’s fingerprint reader and Chrome and it worked.

2 Likes

Firefox and the same Yubikey model.

2 Likes

Fixed by @dan in

https://github.com/discourse/discourse/commit/f1b97202d445279e8a64a81fddb5678e636f5114

6 Likes