I have been using Xcode 16.2 for a long time. I downloaded it from the developer site. I recently downloaded Xcode 16.3. I was offline on an airplane and I got an error authenticating my account. Since then, I have not been able to sign my apps. I was able to create a new app that worked but in my effort to resolve the problem, I deleted my account and now I cannot add it back. I was getting a "bad URL" error. Now I'm getting "Could not connect to the server." I sent an email to Apple Dev Support and they told me to download Xcode from the App Store. I did that and it gave me the same error. Is anyone else having this problem? If Apple Dev Support cannot resolve it, I don't know how I am going to.
Xcode cannot authenticate my account
I experienced this same issue and found what was causing it in my specific case.
While checking the Xcode-related logs in Console, I discovered that during account authentication, connections were being attempted to localhost and then rejected. This led me to check my /etc/hosts file, which contained this line:
127.0.0.1 developerservices2.apple.com
This was causing all authentication requests to be redirected to localhost instead of Apple's servers. Once I removed this line from the hosts file, I was able to log in to my Apple account in Xcode immediately.
Hope this helps!