otpLogin method

Future<TOtpLoginResponse> otpLogin({
  1. required TOtpLoginBody input,
})

Create an OTP session for a user.

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

See also: stampOtpLogin.

Implementation

Future<TOtpLoginResponse> otpLogin({
  required TOtpLoginBody 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_LOGIN',
  );
  return await request<Map<String, dynamic>, TOtpLoginResponse>(
      "/public/v1/submit/otp_login",
      body,
      (json) => TOtpLoginResponse.fromJson(
          transformActivityResponse(json, 'OtpLogin')));
}