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