Hi there, I've been searching around for methods and tutorials on how to actually login on my account while on eclipse debugging my client, and I think I have found a reliable solution to the problem. Please bear in mind that the version I'm on is 1.12.2 using mcp.
First method: The method of going to your project's run configuration, into arguments and putting --username <name> --password <password>
where <name> would be your username/email and <password> your password. Unfortunately, this method did not work for me, but it appears to work for others in different versions.
Second method: You will need this function and make some adjustments for it to work. Firstly you will make it so that it returns a valid Session, then you would go to your Minecraft class and make so that the current Session is the new Session of the method you just created. You can put the code for the actual change in many places but the one I use and works is located on line 477(Above the second try method of run()). Something like this:
this.session = MyLoginClass.attemptLogin();
Should work. If for some strange reason there is a tutorial on this exact topic and i happened to completely miss it while searching for a solution, please say so, I would appreciate it.