App not behaving the same between platforms?

Hello, over the last few days I made a login script that works off of a Firebase database. It essentially does what you would expect, signs new users up and logs them in when they put their credentials in. There is a decent amount of error handling, and testing every case in Unity (on PC) works just fine. All the errors and success messages come up like they should. Mobile though, is different.

For conciseness, I will attach the login method, since it is the strangest in terms of what it does, and it’s shorter than the signup method(s).

public void LoginButton() { //onclick listener
        Login();
    }

private async void Login() {
        string email = loginEmail.text.ToLower(); //fields from input text
        string password = loginPass.text.ToLower();
        if (await CheckIfEmailAndPasswordMatch(email, password)) { //wait for the method to finish
            loginError.text = "You were logged in! This would normally trigger the app loading.";
        } else {
            return; //can only return if the return type is 'void' or 'Task<T>'
        }
    }

private async Task<bool> CheckIfEmailAndPasswordMatch(string email, string password) {
        DataSnapshot snap = await userAccountDB.Child("Users").Child(email.Remove(email.IndexOf("@"))).Child("email").GetValueAsync();
        if ((String)snap.Value == email) {
            DataSnapshot snap2 = await userAccountDB.Child("Users").Child(email.Remove(email.IndexOf("@"))).Child("password").GetValueAsync();
            if ((String)snap2.Value == password) {
                return true;
            } else {
                ErrorReporter("incorrectEmailOrPass");
                return false;
            }
        } else {
            ErrorReporter("incorrectEmailOrPass");
            return false;
        }
    }

Again, everything works perfectly on desktop editor runtime. On mobile, putting in an incorrect username or password will tell you they’re incorrect, but once correct ones are inputted it doesn’t give the login message. Does anyone know why this behavior is occurring? Can Android not handle async/await or Tasks? I am lost, so any help is greatly appreciated! Thank you!

Are you… are you comparing the user’s password to a plaintext password from the database… on your client?

Tell me I’m crazy and that’s not what’s happening here right? If that’s actually what’s happening you are begging to get hacked. Like with a 5 mile tall sign that says ā€œHACK MEā€.

2 Likes

Well, the app is about 1% complete, so I don’t think encryption is exactly important considering the app has no real users, nor is it accessible to anyone but the people in my company. I just need help with my question, not a ā€˜use cryptography!’ lesson.

Forget the plaintext part, I’m even more worried about the part where you are sending the password to the client.

2 Likes

I’ve been given instructions by my project leader to create a basic login script. I need to know why it functions differently on different platforms.

We will handle the insecurities. That wasn’t any part of my question at all.