Topic: API login always false

Can somebody help me please? For a project I am making, I try to log in into the API with my username and password and it just doesn't let me. I always get a {"success":false} response and I don't know why.
This is the general code I used to try log in:

String userName = getUsernameInput();
String password = getPasswordInput();

String passwordHashResponseJSON = sendRequest(RequestType.POST, "https://e621.net/user/login.json?name=" + userName + "&password=" + password);

//This creates an object that contains the attributes from the JSON
Object data = fromJSON(passwordHashResponseJSON);

//Then I login
String logInSuccess = getRequest(Request.POST, "https://e621.net/user/login.json?login=" + data.name + "&password_hash=" + data.password_hash);

screen.output(logInSuccess);

The output is always

{"success":false}

Why does that happen? I know I am probably doing this all wrong but still, that is why I need your help, so please, tell me what am I doing wrong...

BTW, I am actually coding in Java if that is helpful somehow ;)

Updated