completeMfaSignIn method
Complete an MFA sign in using a time-based one-time password.
This is only necessary if the user has MFA enabled.
otp
is the OTP generated by the user's password manager, and ticket
is the AuthResponse.mfa.ticket
returned by a preceding call to signInEmailPassword.
Throws an NhostException if logging in via MFA fails.
Implementation
Future<AuthResponse> completeMfaSignIn({
required String otp,
required String ticket,
}) async {
final res = await _apiClient.post<AuthResponse>(
'/signin/mfa/totp',
jsonBody: {
'otp': otp,
'ticket': ticket,
},
responseDeserializer: AuthResponse.fromJson,
);
await setSession(res.session!);
return res;
}