Running ArcGIS Pro 2.8 and ArcGIS Enterprise 10.9
I have a simple script that I need to run from ArcGIS Pro that will get a token from our Portal and use that to connect to my GIS. The user needs to signed into the Portal in ArcGIS Pro and have it set as the active portal.
from arcgis.gis import GIS
# Get a Token
portalURL = arcpy.GetActivePortalURL()
token = arcpy.GetSigninToken()
if token is not None:
token = (token['token'])
gis = GIS(portalURL, token = token, verify_cert=False)
print(token)
else:
print('Fail.')
Line 8 fails with an invalid Token error. I can print the token and confirm it's valid. Any idea how I can use the token to connect to the GIS?
Exception: Invalid token.
(Error Code: 498)
Solved! Go to Solution.
line 8 is a enclosed in ( ) ... (token['token'])
GetSigninToken—ArcGIS Pro | Documentation
try token['token'] without the ( ) ... just in case it matters on the receiving end (although it shouldn't be a tuple)
line 8 is a enclosed in ( ) ... (token['token'])
GetSigninToken—ArcGIS Pro | Documentation
try token['token'] without the ( ) ... just in case it matters on the receiving end (although it shouldn't be a tuple)