Skip to content

Commit 0e5569c

Browse files
committed
fix: support all mfa auth methods
1 parent a12b097 commit 0e5569c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

packages/gotrue/lib/src/types/mfa.dart

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,24 @@ class AuthMFAGetAuthenticatorAssuranceLevelResponse {
257257
});
258258
}
259259

260-
enum AMRMethod { password, otp, oauth, totp, magiclink }
260+
enum AMRMethod {
261+
password('password'),
262+
otp('otp'),
263+
oauth('oauth'),
264+
totp('totp'),
265+
magiclink('magiclink'),
266+
recovery('recovery'),
267+
invite('invite'),
268+
ssoSaml('sso/saml'),
269+
emailSignUp('email/signup'),
270+
emailChange('email_change'),
271+
tokenRefresh('token_refresh'),
272+
anonymous('anonymous'),
273+
mfaPhone('mfa/phone');
274+
275+
final String code;
276+
const AMRMethod(this.code);
277+
}
261278

262279
/// An authentication method reference (AMR) entry.
263280
///
@@ -278,7 +295,7 @@ class AMREntry {
278295
factory AMREntry.fromJson(Map<String, dynamic> json) {
279296
return AMREntry(
280297
method: AMRMethod.values.firstWhere(
281-
(e) => e.name == json['method'],
298+
(e) => e.code == json['method'],
282299
),
283300
timestamp: DateTime.fromMillisecondsSinceEpoch(json['timestamp'] * 1000),
284301
);

0 commit comments

Comments
 (0)