Select to view content in your preferred language

Python API can't connect to portal with windows authentication

10932
14
09-03-2017 06:10 PM
simoxu
by MVP Regular Contributor
MVP Regular Contributor

Hi folks,

I am new to this API, I tried it with ArcGIS Online it works fine. But when I try to connect to our local ArcGIS portal, it doesn't work. Can anybody kindly point me to the right direction? I highly suspect that the problem is the API can't pick up my windows credentials which is required to login the portal.

More information:

Our portal is using IWA authentication, and this document for IWA points to not using a username or password:

 

It looks like there are some additional requirements for using IWA and the ArcGIS Python API:

"If your portal is configured to pick up your Windows credeintials using NTLM or Kerberos, you can omit passing in the username and password. The ArcGIS Python API is able to figure out when the GIS is using Windows authentication and picks the login credentials from the currently running process providing a seamless and secure login experience. Windows authentication only works on the Windows OS and requires pywin32 and kerberos-sspi python packages."

Please see the screen dump for details: (click to zoom in)

 

 

Tags (2)
14 Replies
simoxu
by MVP Regular Contributor
MVP Regular Contributor

Hi David

Sorry it is a bit vague to say  "I overwrote the arcgis related packages under anaconda3 using the packages under ArcGIS pro", and even myself is a little confused when looking at this statement now.I had to find my note for that period of time to help me to recall the stuff I was talking about. I'll try my best to explain...

Firstly, I am surprised that people are still having this issue --- I thought it was solved long time ago. At that time, the latest API version was 2.3.1, and the latest Python was 3.6

Secondly, the motivation for me to replace the arcgis package in Anaconda is that the arcgis python environment was working in Pro 2.0 at that moment. By the way, Anaconda version much less a problem than the arcgis package version itself.

Thirdly, Python interpreter version matters in this case. I tried out that Python 3.5.x was the working version for the Python API for ArcGIS 1.0.1.  And Python 3.6 didn't work.

Last but not least, I didn't want to lose the advanced functionalities in the Python API for ArcGIS 2.x as a result of replacing it with lower version installed with ArcGIS Pro 2.0, I used an alternative approach to change the source code in the latest Python API version 2.3.1 to make it working.

Here are the relevant notes from my old notebook, kind of fun for me to read these paper notes (nostalgia).  Sorry for the scribbles --- they were only meant to be quick reminders for myself really, and without those notes I will never remember what I did 11 months ago

 

Cause:

Issue and cause

Solution:

Solution

Python 3.6 issue:

Bug in Python 3.6

Follow up and some thought

Follow up and recommendation

ScottStopyak
Frequent Contributor

I had a script running for almost a year that logs in to AGO and overwrites a feature service but it hasn't worked for about a month now. I'm thinking that the failures coincide with the most recent Pro upgrade, but I'm not sure. It now fails with an ArcGIS Pro crash message even though Pro isn't actually running.

0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

It seems you are using ArcGIS Pro to authorize your Python API. In this case, the API will connect to the active portal  set in ArcGIS Pro.

https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#Connecting...

Which version of ArcGIS API for Python are you using? the latest version supports IWA better.

JoeHershman
MVP Regular Contributor

So you are saying that one cannot run the Python API on a machine that does not have ArcGIS Pro installed?  That is a a very limiting restriction.  Logging into Portal should provide the required license.

Thanks,
-Joe
0 Kudos
simoxu
by MVP Regular Contributor
MVP Regular Contributor

ArcGIS API for Python does not require a license, but it is built for ArcGIS Portal and ArcGIS Online which are licensed. ArcGIS Pro has ArcGIS API for Python installed along side with Arcpy, which brings much more powerful capacities when dealing with local GIS.