Page MenuHomePhabricator

[iOS] Add support for selectable TOTP module when logging in with MFA.
Closed, ResolvedPublic3 Estimated Story Points

Description

As part of WE4.6.2, functionality is being added to allow users to enable multiple authentication factors, which includes WebAuthn and TOTP. When we log in through the API, and the user has multiple authenticators enabled, the login response will become slightly different, and will allow us to "select" the factor to be used. (Since we don't yet support WebAuthn, we will need to explicitly select TOTP.)

The logic for working with the new selection logic is laid out in this task.

(At the moment, there is some fallback compatibility logic that makes the API work as before with existing clients, but this will be removed once these tasks are complete and rolled out.)

Test Steps

Regression test our login flow, confirm it still works for both non-2-factor users and 2-factor users.

Event Timeline

Tsevener set the point value for this task to 3.Sep 18 2025, 3:23 PM

Progress is in T403820_mfa-support branch.

I think I have it working with the task instructions:

  1. In the action=clientlogin call, I detect TwoFactorModuleSelectAuthenticationRequest with totp in the allowedModules response.
  2. If this exists, I repeat the action=clientlogin call, with a newModule=totp in the request body.

There's a couple of issues I have when testing on the beta cluster with an account set up with both TOTP and WebAuthn.

  1. The first call returns TOTPAuthenticationRequest, which means the hack is still there on the beta cluster. So I don't feel like this is a true test.
  2. The second call has a warning in the response body: Unrecognized parameter: newModule.

So something is off about the beta cluster or the way I am making the calls. I tried setting up a local MW instance but I wasn't able to get a WebAuthn key added.

Change #1191740 had a related patch set uploaded (by Dbrant; author: Dbrant):

[mediawiki/extensions/OATHAuth@master] [WIP] Remove backward compatibility for Apps' login flow.

https://gerrit.wikimedia.org/r/1191740

Test wiki created on Patch demo by Dmitry Brant using patch(es) linked to this task:
https://d22139cba6.catalyst.wmcloud.org/w/

Just FYI, the work from FY2025-26 WE4.6.2 Multiple Authenticators should now be available on the beta cluster to test as well.

ABorbaWMF subscribed.

Appears to be fixed on 7.8.4 (5853)

Tested on iPhone 16 on iOS 26 and iPad 12.9 on iPadOS 26. Tested with my WMF account with 2FA and Captcha.