otpAuth method

Future<TOtpAuthResponse> otpAuth({
  1. required TOtpAuthBody input,
})

Authenticate a user with an OTP code sent via email or SMS.

Sign the provided TOtpAuthBody with the client's stamp function and submit the request (POST /public/v1/submit/otp_auth).

See also: stampOtpAuth.

Implementation

Future<TOtpAuthResponse> otpAuth({
  required TOtpAuthBody input,
}) async {
  final body = packActivityBody(
    bodyJson: input.toJson(),
    fallbackOrganizationId: input.organizationId ??
        config.organizationId ??
        (throw Exception(
            "Missing organization ID, please pass in a sub-organizationId or instantiate the client with one.")),
    activityType: 'ACTIVITY_TYPE_OTP_AUTH',
  );
  return await request<Map<String, dynamic>, TOtpAuthResponse>(
      "/public/v1/submit/otp_auth",
      body,
      (json) => TOtpAuthResponse.fromJson(
          transformActivityResponse(json, 'OtpAuth')));
}