I have noticed this bug before on Meta, but then it appeared on my deployments after the latest upgrade: when clicking login, the “Welcome back ” modal appears, and is immediately shadowed by “Sorry, an error occurred”. Clicking OK removes the error modal and you can resume authentication normally.
There’s an error log in the console:
ajax-error.js:9:12
l ajax-error.js:9
p ajax-error.js:95
passkeyLogin login.js:147
2 Likes
Moin
February 1, 2024, 12:38am
2
Which browser do you use?
Firefox 115.7.0esr (64-bit) on Debian 12.
Discourse v3.3.0.beta1-dev — Commits · discourse/discourse · GitHub — Ember v5.5.0
1 Like
Moin
February 1, 2024, 12:41am
4
2 Likes
This is a regression introduced here: FEATURE: Allow users to confirm session with passkeys (#24337) · discourse/discourse@c6ead3f · GitHub
) {
if (!isWebauthnSupported()) {
return errorCallback(I18n.t("login.security_key_support_missing_error"));
}
// we need to check isConditionalMediationAvailable for Firefox
// without it, Firefox will throw console errors
// We cannot do a general check because iOS Safari and Chrome in Selenium quietly support the feature
// but they do not support the PublicKeyCredential.isConditionalMediationAvailable() method
if (mediation === "conditional" && isFirefox) {
const isCMA = await PublicKeyCredential.isConditionalMediationAvailable();
if (!isCMA) {
return;
}
}
try {
const resp = await ajax("/session/passkey/challenge.json");
const credential = await navigator.credentials.get({
publicKey: {
I think the code needs to be moved in the try{}
below; otherwise, the error will use the UI instead of the console.
userHandle: bufferToBase64(credential.response.userHandle),
};
} catch (error) {
if (error.name === "AbortError") {
// no need to show an error when the cancelling a pending ceremony
// this happens when switching from the conditional method (username input autofill)
// to the optional method (login button) or vice versa
return null;
}
if (mediation === "conditional") {
// The conditional method gets triggered in the background
// it's not helpful to show errors for it in the UI
// eslint-disable-next-line no-console
console.error(error);
return null;
}
if (error.name === "NotAllowedError") {
return errorCallback(I18n.t("login.security_key_not_allowed_error"));
} else if (error.name === "SecurityError") {
4 Likes
pmusaraj
(Penar Musaraj)
February 2, 2024, 9:40pm
7
Thanks for the report. This should be fixed via FIX: Handle old Firefox versions that do not support isConditionalMed… by pmusaraj · Pull Request #25549 · discourse/discourse · GitHub , I could only repro with that version of Firefox on Windows/macOS, but the fix should apply to other OSs as well.
3 Likes
pmusaraj
(Penar Musaraj)
Closed
February 6, 2024, 10:41pm
9
This topic was automatically closed after 4 days. New replies are no longer allowed.