Exception: User not allowed for this account using arcgis.gis

390
1
Jump to solution
02-13-2024 06:48 AM
Labels (3)
FrancescPuigvert
New Contributor II

I'm trying to connect to Portal for ArcGIS using the Python ArcGIS API and a user administrator account.

However, when I try to authenticate with the Python code, I get error: "Exception: User not allowed for this account"

URL= 'https://domain.name.com/portalgis'
ARCGIS_USER = 'user'
ARCGIS_PASSWORD = 'password'

gis = GIS (url=URL, username=ARCGIS_USER, password=ARCGIS_PASSWORD)

If I try to connect with API Rest, I can:

headers = {'content-type': 'application/form-data'}
payload = {
'f': 'json',
"username": ARCGIS_USER,
'password': ARCGIS_PASSWORD,
'client': 'reference',
'reference': URL,
"expiry": 21600
}
req = requests.post('{}/sharing/rest/generateToken'.format(URL),data=payload, verify=False)

# Extract the token
token = json.loads(req.content.decode('utf-8'))
token = token['token']
print ('--> TOKEN {}'.format(token))

Setting portal logging in debug mode, I'm getting: "com.esri.gw.oauth2.OAuth2Exception: Invalid redirect_uri at com.esri.gw.filters.SecurityFilter.doFilter(SecurityFilter.java:100) at ... at  java.base/java.lang.Thread.run(Unknown Source)"

I'm using ArcGIS Enterprise v11.2. This problem occurs after upgrade from v10.8.1 (The privatePortalURL of portaladmin Home > System > Properties is set correctly).

0 Kudos
1 Solution

Accepted Solutions
FrancescPuigvert
New Contributor II

Solved. Connect without webadaptor. Post [url]

"Does your Portal use Integrated Windows Authentication? If so, try replacing the URL with the fully qualified domain name and port number. (https://portalMachine.domain:7443/arcgis/home) You should not be automatically authenticated as the viewer account when using this URL.

-Josh"

 

This is: https://machinename: port/arcgis.

View solution in original post

0 Kudos
1 Reply
FrancescPuigvert
New Contributor II

Solved. Connect without webadaptor. Post [url]

"Does your Portal use Integrated Windows Authentication? If so, try replacing the URL with the fully qualified domain name and port number. (https://portalMachine.domain:7443/arcgis/home) You should not be automatically authenticated as the viewer account when using this URL.

-Josh"

 

This is: https://machinename: port/arcgis.

0 Kudos