I know this is old and is for Javascript API - though having the same issue and solving it in python I thought I'd provide the answer to anyone else that searches for the {'ssl': {'supportsSSL': True, 'sslPort': 6443}} return and finds this question.
I came into this problem when updating python2 scripts to python3 and getting tired of all the encoding that urllib requires for it to work. I changed the package I am using from 'urllib ( , 2 and 3)' to the 'requests' package. The requests package makes it super simple and clean-
token = requests.get(url, query_dict).json()
For me, it was that I was using a GET request for the Token when the server is not set up for that request. Changing it to a POST request fixed it.
token = requests.post(url, query_dict).json()
So maybe the culprit servers are not set up for the type of request is being sent. This article provided the information to find what I had wrong-
Enable token acquisition through an HTTP GET request—Documentation (10.4) | ArcGIS Enterprise and cautions against the GET request method:
Caution:
Although using a GET request is a convenient method of acquiring a token, a user's credentials are provided as part of the URL and may be stored in browser history or in network components. It's recommended that you update your applications so that tokens are not acquired through a GET request.