diff --git a/packages/supabase_auth/lib/src/auth_admin_mfa_api.dart b/packages/supabase_auth/lib/src/auth_admin_mfa_api.dart index 1b84999c5..45e1ec9c2 100644 --- a/packages/supabase_auth/lib/src/auth_admin_mfa_api.dart +++ b/packages/supabase_auth/lib/src/auth_admin_mfa_api.dart @@ -39,8 +39,9 @@ class AuthAdminMFAApi { /// Updates the MFA factor identified by [factorId] on the user identified /// by [userId]. /// - /// Only the fields that are given are changed. The server ignores [phone] - /// on any factor that is not a phone factor. + /// Only the fields that are given are changed. The server treats an empty + /// string as not given, so a friendly name cannot be cleared, and it + /// ignores [phone] on any factor that is not a phone factor. Future updateFactor({ required String userId, required String factorId, diff --git a/packages/supabase_auth/test/src/auth_admin_mfa_api_test.dart b/packages/supabase_auth/test/src/auth_admin_mfa_api_test.dart index 8f6f003fb..eb7d022b2 100644 --- a/packages/supabase_auth/test/src/auth_admin_mfa_api_test.dart +++ b/packages/supabase_auth/test/src/auth_admin_mfa_api_test.dart @@ -76,6 +76,18 @@ void main() { expect(response.factor.friendlyName, 'VerifiedFactor'); }); + test('update factor ignores the phone on a totp factor', () async { + final response = await client.admin.mfa.updateFactor( + userId: userId2, + factorId: factorId2, + phone: '+15555550100', + ); + + expect(response.factor.id, factorId2); + expect(response.factor.factorType, FactorType.totp); + expect(response.factor.friendlyName, 'VerifiedFactor'); + }); + test('delete factor', () async { final response = await client.admin.mfa.deleteFactor( userId: userId2,