Skip to content

Commit c13ed34

Browse files
dshukertjrgrdsdev
andauthored
Update packages/gotrue/lib/src/gotrue_mfa_api.dart
Co-authored-by: Guilherme Souza <[email protected]>
1 parent a17f875 commit c13ed34

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/gotrue/lib/src/gotrue_mfa_api.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,12 @@ class GoTrueMFAApi {
5656
'factor_type': factorType.name,
5757
};
5858

59-
if (factorType == FactorType.totp) {
59+
if (factorType == FactorType.totp && issuer != null) {
6060
body['issuer'] = issuer;
61-
} else if (factorType == FactorType.phone) {
62-
if (phone == null) {
63-
throw ArgumentError('Phone number is required for phone factor type');
64-
}
61+
} else if (factorType == FactorType.phone && phone != null) {
6562
body['phone'] = phone;
63+
} else {
64+
throw ArgumentError('Invalid arguments, expected an issuer for totp factor type or phone for phone factor. type');
6665
}
6766

6867
final data = await _fetch.request(

0 commit comments

Comments
 (0)