Select to view content in your preferred language

Cannot access feature layer attachments with valid oauth2 token.

03-06-2023 10:08 PM
New Contributor III

Hi. I have a feature layer, which is the data collected from a Survey123 form. Each item has attachments (images). I have set up webhooks for the survey to send the survey entry to a custom server when a user submits the survey. This is all working.

Included in the webhook's payload is an URL from which to download the attachments. This is something like

. The documentation I've read says to use this URL with the parameter


. THE_TOKEN is obtained from another rest call to ESRI api using a clientID and clientSecret I have obtained using with my organization login (college), creating a new oauth2 application.

This all worked flawlessly on a survey123 that I created for testing, and also shared with a group within the organization. However,  a team member created the final version of the survey. It is shared with the group and, as far as we can tell, all the sharing settings were exactly the same as the test survey and feature layer.

But, every time my server attempts to download the attachments (or even if I try manually in the browser), I'm getting an error telling me I don't have permission to access the attachments.


The message is very clear of course.

But what am I doing wrong? I can view/edit/etc all the data in the non-test feature layer when I log in to the AGOL and survey123 web portals, which implies that my account does in fact have permission to access those resources. As far as we can see, the only difference between the test and non-test stuff is that I didn't create (and am not the owner) of the non-test stuff. Since my code works perfectly with the test feature layer/survey, it must be something on the ESRI side of things.



I had my team member create some credentials, and everything worked perfectly using these credentials created with their account. It would be great to figure this out for future reference. I would imagine teams working together on a project as we are is a common thing.

0 Kudos
0 Replies