AnsweredAssumed Answered

python API fails with IWA for federated ArcGIS servers

Question asked by bhp_damianslee on Aug 29, 2018
Latest reply on Sep 4, 2018 by bhp_damianslee


Have found that when using python API with IWA enabled Portal,  the python API works fine with Portal operations, but fails on Server requests due to an issue with generate_token().    a POST request is being sent with &token=None, which is rejected.



REQUEST: https://myportalserver/portal/sharing/rest/generateToken, {'serverURL': 'https://myfederatedarcgiserver/arcgis/admin', 'token': None, 'expiration': '1440', 'f': 'json', 'request': 'getToken', 'referer': 'http'}


RESPONSE: https://myportalserver/portal/sharing/rest/generateToken, {"error":{"code":400,"message":"Unable to generate token.","details":["Unable to generate token for this server"]}}




gis = GIS("https://myportalserver/portal")

print("Logged in as: " +

#this fails

gis_servers = gis.admin.servers.list()



python api 1.5.0 

Python 3.6.4 with arcgis pip installed from

Portal 10.5.1

ArcGIS server 10.5.1 federated with portal

IIS web adapter /portal   (Windows authentication enabled, anonymous disabled)

IIS web adapter /arcgis    (Anonymous enabled)