I am trying to connect to a Portal that uses IWA and get an error:
<class 'pywintypes.error'>
Failed Kerberos authentication
I have tried both the domain accounts and the initial administrator account setup with same issue. Is it possible to login to a site with IWA? If so what am I not doing correct
target = GIS("https://pmydoamin.com/portal", "user@domain", "pwd", verify_cert=False) Thanks
Solved! Go to Solution.
Hi Rohit,
I tried everything I can, but I still can't connect to my portal with IWA.
I get HTTP 401 error: unauthorized.
I posted in another discussion, could you please have a look?
Python API can't connect to portal with windows authentication
Thanks.
I agree this is confusing... we'll take care of it in the next update. Thanks for the suggestion.
How can I suppress those messages below for now when using IWA using NTLM?
<class 'pywintypes.error'> Failed Kerberos authentication
I have not been doing anything since the newest API was released. When trying to connect with IWA (not passing credentials I now get the following and no connection is established. I have no issue connecting to portal through my browser and IWA works as expected.
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-13-740700131cc8> in <module>()
2
----> 4 portal = GIS("https://portaldev.ramtech-gis.com/portal", verify_cert=False)
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\gis.py in __init__(self, url, username, password, key_file, cert_file, verify_cert, set_active)
91 self._datastores_list = None
92 self._portal = portalpy.Portal(self._url, self._username, self._password, self._key_file, self._cert_file,
---> 93 verify_cert=self._verify_cert)
94
95 if self._url.lower() == "pro":
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\portalpy.py in __init__(self, url, username, password, key_file, cert_file, expiration, referer, proxy_host, proxy_port, connection, workdir, tokenurl, verify_cert)
159 verify_cert=verify_cert)
160 #self.get_version(True)
--> 161 self.get_properties(True)
162
163
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\portalpy.py in get_properties(self, force)
973 if not self._properties or force:
974 path = 'accounts/self' if self._is_pre_162 else 'portals/self'
--> 975 resp = self.con.post(path, self._postdata(), ssl=True)
976 if resp:
977 self._properties = resp
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\connection.py in post(self, path, postdata, files, ssl, compress, is_retry, use_ordered_dict, add_token, verify_cert, token)
912 headers.append(('Accept-encoding', 'gzip'))
913
--> 914 handlers = self.get_handlers(verify_cert)
915 opener = request.build_opener(*handlers)
916
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\connection.py in get_handlers(self, verify_cert)
810 from .common._iwa import NtlmSspiAuthHandler, KerberosSspiAuthHandler
811
--> 812 auth_NTLM = NtlmSspiAuthHandler()
813 auth_krb = KerberosSspiAuthHandler()
814
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\common\_iwa.py in __init__(self)
53
54 def __init__(self):
---> 55 self.sspiauth = SSPINTLMAuth()
56
57 def http_error_401(self, req, fp, code, msg, headers):
C:\ArcGISPython\Anaconda\lib\site-packages\arcgis\_impl\common\_iwa.py in __init__(self, user)
17 if not user:
18 user = win32api.GetUserName()
---> 19 self.sspi_client = sspi.ClientAuth("NTLM",user)
20
21
C:\ArcGISPython\Anaconda\lib\site-packages\win32\lib\sspi.py in __init__(self, pkg_name, client_name, auth_info, targetspn, scflags, datarep)
109 client_name, self.pkg_info['Name'],
110 sspicon.SECPKG_CRED_OUTBOUND,
--> 111 None, auth_info)
112 _BaseAuth.__init__(self)
113
ValueError: year 30828 is out of range
FYI
Python for Windows Extensions / Bugs / #748 pywin32 issue(s) under Python 3.6.1
Try Python 3.5.4, it works for me.