verifyBackUpCode method
Verify backup code
code The backup code
trustDevice If true, the device will be trusted for 30 days. It'll be refreshed on every sign in request within this time.
disableSession If true, the session cookie will not be set.
Implementation
Future<SessionResponse<User>> verifyBackUpCode({
required String code,
bool trustDevice = false,
bool disableSession = false,
}) async {
try {
final response = await dio.post(
"/two-factor/verify-backup-code",
data: {"code": code, "trustDevice": trustDevice, "disableSession": disableSession},
options: await super.getOptions(),
);
return SessionResponse.fromJson(response.data, User.fromJson);
} catch (e) {
final message = getErrorMessage(e);
if (message == null) rethrow;
throw message;
}
}