Running ArcGIS Pro 2.8 and ArcGIS Enterprise 10.9
This script should retrieve a token from an active Portal connection in ArcGIS Pro.
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)