Hi All,
I've been accessing our ArcGIS Online site via token in ArcGIS Python API without any issues for the past couple of months.
I seem to be having issues authenticating via an access token now.
from arcgis.gis import GIS
gis = GIS(url=portal, token=accessToken)
In the API references , I also realised that it mentions the below:
token | Optional string. This is the Enterprise token for built-in logins. This parameter is only honored if the username/password is None and the security for the site uses BUILT-IN security. |
Our AGOL site is configured with Enterprise Login and I use the token authentication to login with my Enterprise login.
Did something change recently and is this still a supported method of authentication? It has significant ramifications to our org if it is no longer supported.
Regards,
Weng
Solved! Go to Solution.
Finally found the issue, the solution was actually pretty simple:
gis = GIS(url=portal, token=accessToken)
only supports portal = https://www.arcgis.com as documented in the API reference.
If you set it to your own portal's URL, it will not work. So the solution was to set it to the default https://www.arcgis.com .
Hello,
I'm not familiar with method of authentication but would be happy to take a look. Can you share where you normally get the token from?
Thanks,
Josh
I use the following method( grant type = authorization code) to get an access token :
Token—ArcGIS REST API | ArcGIS for Developers
Then , I use the access token generated to authenticate using ArcGIS Python API as mentioned above .
Tokens expire, are you sure yours didn't?
I realise it is short lived for AGOL (30 mins), but pretty sure the token worked as I can append it to the end of my site's URL to access REST .
Finally found the issue, the solution was actually pretty simple:
gis = GIS(url=portal, token=accessToken)
only supports portal = https://www.arcgis.com as documented in the API reference.
If you set it to your own portal's URL, it will not work. So the solution was to set it to the default https://www.arcgis.com .