We have an OMS (outage management system), Pragma, that we want to consume secure Esri services. They have a URL with a token on the end in their config file. They application will then use this token for each call the to the Esri service.
So, the URL would look something like :
"https://our-server/server/rest/services/Testing/OMS/MapServer/tile/{0}/{2}/{1}/256/png8?token="
How do I go about creating this token?
I never used that service and not sure about the language. But generally if I remember correctly, when you have an ArcGIS organizational subscription or an ArcGIS Enterprise license, when you start the session the token is already generated and by using the following code (in Python) on ArcGISPro you can get your token. (not sure about other licenses and online version)
import arcpy
# return a dictionary with token and other stuff
token = arcpy.GetSigninToken()
if token is not None:
print(token.keys()) # keys of that dictionary
you can pass your token as token['token'] to the above-mentioned link like this:
Just remember once you added the token you don't want to share that link online.
Thanks for the feedback. Is there not a way to get it from the Portal Admin Site.
If the server is federated with ArcGIS Portal, see the documentation here.
If it is standalone, check here.
@TonyContreras_Frisco_TX Thanks! That works. Any idea how I get it to last longer then two weeks?
You're welcome. I think that 15 days is the max expiration for Portal, which cannot be changed. requests for anything beyond 15 will fail, according to the documentation.
If it is a standalone server, you can modify the Token Configuration to set the Long Timeout (Max timeout length in minutes) using the REST Admin API