Select to view content in your preferred language

Exception: Unable to generate oauth token

1509
6
10-14-2023 01:30 AM
TZ
by
New Contributor II

I am trying to Connect to ArcGIS Enterprise v11.1 using a built-in account as described in tutorial --> https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authe...

Here is my entire code:

---------------------------------------------------------

from arcgis.gis import GIS

portal_url = 'https://myserver.org/portal/portaladmin/'

username = 'portaladmin'

password = 'pasw1234'

print("Portal for ArcGIS as a built in user")
gis = GIS(portal_url, username, password)
print("Logged in as: " + gis.properties.user.username)
 
------------------------------------------------
i get this error:
 
Exception: Unable to generate oauth token
 
How to solve this? Do i have to register this simple script as an App in Azure AD or something?

 

 

6 Replies
EarlMedina
Esri Regular Contributor

Remove "portaladmin". It should be: "https://myserver.org/portal" from your example.

0 Kudos
TZ
by
New Contributor II

I changed the "portal_url" value to "https://myserver.org/portal" as per your suggestion but still get the same error "Unable to generate oauth token", the only difference being an informational message "Portal for ArcGIS as a built in user" in the output at the very beginning.

Are there any more guides regarding setting up OAuth for ArcGIS Python API aside this very scant page ? --> https://developers.arcgis.com/python/guide/working-with-different-authentication-schemes/#User-authe...

0 Kudos
TZ
by
New Contributor II

and what about my previous question - do i have to register this modest script as an app in Azure AD or not??

0 Kudos
EarlMedina
Esri Regular Contributor

Are you saying this is in fact not a built in user? Are you actually using Azure AD? DO you happen to know how the portal was sconfigured?

0 Kudos
ellipsol
New Contributor III

I started seeing this same issue that started yesterday. Do you have a solution or work-around? I've been using this calls in scripts for more than a year, no problem until now.

ellipsol_0-1697751666618.png

 

0 Kudos
ellipsol
New Contributor III

My proxy changed and that was what was causing this error. It is resolved now.

0 Kudos