I was able to connect using just "gis = GIS()" and I was able to walk through the Esri code in a debugger.
if you leave out the URL it plugs in "https://www.arcgis.com".
If you leave out password but give it a user it will prompt you to type a password.
If you leave out username then it tries to use a token from your environment settings.
If you don't have a token in your environment and no username or password it create an anonymous login.
If there is a token setting and the token is wrong that would do it. The setting is "ESRI_API_KEY".
The other advice I could offer is, get a good Python debugger if you are not already using one. I recommend Microsoft Visual Studio Code, it's free, I spend about 6 1/2 hours of my workday using it. There is a setting you need to put in launch.json file "justMyCode = false" to get it to go into the Esri code. If you did this you could see a little more of what is happening. I can walk you through that if you go that route.