Hi guys,
We are trying to connect to a portal using Python API and we have got some issues with it. The use case here is that we want to authenticate non-interactive fashion to the portal using OAuth on times fashion. Basically we have followed this guide. When we run the code, we see following error:
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\arcgis\_impl\connection.py
in oauth_authenticate(self, client_id, expiration)
462 'username': self._username,
463 'password': self._password,
--> 464 'oauth_state': oauth_info['oauth_state']
465 }
466 content = self.post('oauth2/signin', parameters, ssl=True, try_json=False, add_token=False)
UnboundLocalError: local variable 'oauth_info' referenced before assignment
Code used:
from arcgis.gis import GIS
gis = GIS("https://{{portalurlhere}}/home",
username='{{usernamehere}}',
password='{{passwordhere}}',
client_id='{{clientidhere}}')
print("Successfully logged in as: " + gis.properties.user.username)
Atma Mani Rohit Singh Any idea what we are doing wrong here? Do you think this is an issue in the API?