"Token Required" error

6787
8
03-01-2023 09:49 AM
fjramos
Frequent Contributor

Good afternoon,

Yesterday colleagues started having an issue when trying to access hosted feature layers that I created (as publisher) on a map. They would open the map overview, click a feature on the layer list to access the layer group, then export the data, but now they started receiving a "Token Required" error. I still have this ability and other colleagues do to that have admin privileges', but the ones that don't have admin privileges' lost the ability to access the layer group, through the map overview and now receive that "Token Required" error, which they didn't a couple days ago. We tried troubleshooting a bit, but still couldn't figure out why this was happening. They can still access the layer group, by going under their "Group" tab and finding it that way, but they can't access it through the web map that I created. I did look up previous posts, but didn't find any solutions other than accessing the REST servers for the layers. Any info would be greatly appreciated.

fjramos_1-1677692275769.png

 

fjramos_0-1677691490559.png

 

8 Replies
RhettZufelt
MVP Notable Contributor

How are they trying to export the data?

If I follow your example, after clicking the layer to access the layer group, it takes me to the item details for that hosted feature layer.  Once there, there is an Export Data dropdown that gives several options.  However, I don't see any that actually take me to the REST point as you second pic.

I only get that if I try to get to it with the URL at bottom right of the detail page.

If you are trying to get access to that (using URL), you can't just copy/paste the url anymore as it will substitute your org for the services1 server.  If this is what you are after, you need to click the "View" link next to URL,

RhettZufelt_0-1677705918441.png

 

then, when the services open, right click on the link to server and open in new tab/window.  This will get you to the service with credentials and won't get the token error.

RhettZufelt_1-1677705976553.png

 

R_

fjramos
Frequent Contributor

They export exactly how you mentioned ever since we started using AGOL a year ago; 

1.) Map Overview >

fjramos_0-1677706833276.png

2.) Click feature layer (from list) >

fjramos_1-1677706880586.png

3.) Group Layer details, then export to shapefile

fjramos_2-1677706966484.png

 

But now for some reason, after step 2.) it takes them to the "Token Required" URL and not the Group Layer items detail page. I did not modify the map or layers prior to this, it just started happening overnight 🤷‍:male_sign:. We did figure out that when they create a exact copy of my map, the "Token Required" URL does not appear after step 2.) and it does take them to the Group Layer details page. However, now for some reason on my original map it takes them to the "Token Required" URL, which it didn't before. Thanks!

 

RhettZufelt
MVP Notable Contributor

That is weird, and I can't reproduce.  I don't ever export to shapefile, so only tested with FGDB.  However, seems it works for shapefiles as well.  Suspect something with that particular map.

Afraid I'm not going to be much help.  You may be able to look at the URL's in the original and the copy using ArcGIS Online Assistant and see if the URL's somehow got mangled with the latest "update.

R_

JosephSia2
Occasional Contributor

I'm encountering a similar issue. In my case, after adding an additional layer to the webmap, existing layers will start redirecting to the token required page. The webmap is backing an app used by operations and there doesn't seem to be a way to easily resolve this and we're getting a hit in user confidence for not having found a deterministic way to deal with it.

fjramos
Frequent Contributor

Good morning,

After speaking with ESRI Tech Support and troubleshooting, we figured out that by ungrouping the layers would solve the "token" problem and it seems to be a bug. Notice on my first screenshot, my layers were in a "Group Layer", I had group them in the webmap to keep those specific layers grouped and to organize my map a bit. It worked fine like that for a while, but now with that bug, a work around is to ungroup the layers. Try that and see if it can help you.

0 Kudos
JosephSia2
Occasional Contributor

Hi,

Thanks for the reply. Yes. we're using grouped layers as well. Unfortunately, the use of group layers is somewhat necessary with as many layers as the users have requested to have. Will need to figure this out. Would you know if there's a place for us to track the status for actions being taken to remediate this? It would really help us manage expectations.

0 Kudos
Jonathan_Goergen
Occasional Contributor

I am having the same issue - but with a feature service to use with Survey123.  I have tried accessing the document from the "View" popup and I still get the token required.  I am the publisher and owner of the tables, and I am logged into ArcGIS Online.  I am trying to get utilize 'pulldata' functionality and while watching the tutorial I got stopped at this point because I cannot get to the REST directory and then into the JSON information.  

 

0 Kudos
Jonathan_Goergen
Occasional Contributor

I had been able to get into this area using a clunky workaround - I would create a token using some script like this:

params = {'f': 'pjson', 'username': userName, 'password': pw, 'referer': 'https://www.arcgis.com', 'expiration': 21600}
tokenURL = 'https://www.arcgis.com/sharing/rest/generateToken'
response = requests.post(tokenURL, data = params, verify = False)
token = response.json()['token'] 

And then manual append the token but that script no longer works.  Would the implementation of MFA short circuit this method? I'll post this somewhere else as it is a different topic 

0 Kudos