This week's book giveaway is in the Java in General forum. We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line! See this thread for details.
What makes you think there is a problem? How do you know you are not being logged in? Is there an error message? what exactly DOES happen?
My larger point is that you need to TellTheDetails. We can't duplicate your problem, and you've removed the URL, ID and PW (which I don't blame you for doing). So from where we are sitting, it could be a wrong, URL, it could be a wrong password, or about a million other things. Help us help you.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
The reason I think I am not logged in is that the page I receive is the same log in page where it asks for the log in username and password and not the "welcome" page where I see my name "confirming that I am logged in".
I suggest using an HTTP monitoring tool. For example, you may use a developer console in Firefox or Chrome. You could see an actual request made by the browser.
As to your problem. You are trying to use HTTP basic authentication. But the site passes login and password as form parameters in the POST request. It also passes other parameters which may or may not matter. You should match browser request as closely as possible first and then you could remove all non-necessary parts from it.