Why is the app displaying “error:” with no text or message after trying to clock in with some credentials?

When trying to sign in with some credentials on an android app an error message saying “error:” pops up, with no text or message and I’m not sure what the problem could be.

I am making this android app that will allow users to sign in with their company id and id fetched from a database and then do face recognition to prove it is them and then clock them in. Then they can clock out by doing the same face recognition process. The database being used is a MySQL run on a Laravel website hosted on ngrok to be used for testing purposes with the android app and and retrofit API for the android app to communicate with teh website and face++ API for the face recognition. It is supposed to sign in but with those credentials but it just displays that pop up saying “error:” and nothing more. The server is up and running and works so I am not sure what the problem is.

public function authenticate(Request $request)
    {
        $employee = User::where('Company_ID', $request->companyId)
            ->where('id', $request->employeeId)
            ->first();

        if ($employee) {
            return response()->json(['success' => true]);
        } else {
            return response()->json(['success' => false]);
        }
    }
package com.example.clockinclockout

import android.content.Intent
import android.os.Bundle
import android.widget.Button
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import retrofit2.Call
import retrofit2.Callback
import retrofit2.Response
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory

class LoginActivity : AppCompatActivity() {

    private lateinit var companyIdEditText: EditText
    private lateinit var employeeIdEditText: EditText
    private lateinit var clockInButton: Button

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_login)

        companyIdEditText = findViewById(R.id.companyIdEditText)
        employeeIdEditText = findViewById(R.id.employeeIdEditText)
        clockInButton = findViewById(R.id.loginButton)

        clockInButton.setOnClickListener {
            val companyId = companyIdEditText.text.toString().toIntOrNull()
            val employeeId = employeeIdEditText.text.toString().toIntOrNull()

            if (companyId != null && employeeId != null) {
                authenticateUser(companyId, employeeId)
            } else {
                Toast.makeText(this, "Please enter valid IDs", Toast.LENGTH_SHORT).show()
            }
        }
    }

    private fun authenticateUser(companyId: Int, employeeId: Int) {
        val retrofit = Retrofit.Builder()
            .baseUrl("https://5162-105-161-215-17.ngrok-free.app")
            .addConverterFactory(GsonConverterFactory.create())
            .build()

        val api = retrofit.create(ApiService::class.java)
        val authRequest = AuthRequest(companyId, employeeId)

        api.authenticateUser(authRequest).enqueue(object : Callback<AuthResponse> {
            override fun onResponse(call: Call<AuthResponse>, response: Response<AuthResponse>) {
                if (response.isSuccessful) {
                    val authResponse = response.body()
                    if (authResponse != null && authResponse.success) {
                        val intent = Intent(this@LoginActivity, FaceRecognitionActivity::class.java)
                        intent.putExtra("companyId", companyId)
                        intent.putExtra("employeeId", employeeId)
                        startActivity(intent)
                        finish()
                    } else {
                        Toast.makeText(this@LoginActivity, "Invalid credentials", Toast.LENGTH_SHORT).show()
                    }
                } else {
                    Toast.makeText(this@LoginActivity, "Error: ${response.message()}", Toast.LENGTH_SHORT).show()
                }
            }

            override fun onFailure(call: Call<AuthResponse>, t: Throwable) {
                Toast.makeText(this@LoginActivity, "Network error: ${t.message}", Toast.LENGTH_SHORT).show()
            }
        })
    }
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:gravity="center"
    android:padding="16dp">

    <EditText
        android:id="@+id/companyIdEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Company ID"
        android:inputType="number" />

    <EditText
        android:id="@+id/employeeIdEditText"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="Employee ID"
        android:inputType="number"
        android:layout_marginTop="16dp"/>

    <Button
        android:id="@+id/loginButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Clock In"
        android:layout_marginTop="16dp"/>
</LinearLayout>
package com.example.clockinclockout

import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.POST


interface ApiService {
    @POST("verify-face")
    fun verifyFace(@Body request: FaceRequest): Call<VerifyFaceResponse>

    @POST("save-face")
    fun saveFace(@Body request: FaceRequest): Call<SaveFaceResponse>

    @POST("clock-in")
    fun clockIn(@Body request: ClockInRequest): Call<ClockInResponse>

    @POST("clock-out")
    fun clockOut(@Body request: ClockOutRequest): Call<ClockOutResponse>

    @POST("authenticate")
    fun authenticateUser(@Body request: AuthRequest): Call<AuthResponse>
}

data class FaceRequest(val companyId: Int, val employeeId: Int, val image: ByteArray)
data class VerifyFaceResponse(val success: Boolean)
data class SaveFaceResponse(val success: Boolean)
data class ClockInRequest(val companyId: Int, val employeeId: Int, val image: ByteArray)
data class ClockInResponse(val success: Boolean)
data class ClockOutRequest(val companyId: Int, val employeeId: Int, val image: ByteArray)
data class ClockOutResponse(val success: Boolean)
data class AuthRequest(val companyId: Int, val employeeId: Int)
data class AuthResponse(val success: Boolean)

This is the code for the clock in functionality in Kotlin and it’s corresponding XML file as well as the PHP controller file where the android app is posting the request.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật