Using the token parameter in survey123

5695
18
Jump to solution
09-05-2020 01:54 PM
PaulSweeney3
Occasional Contributor III

Hi All Can someone explain how the token parameter can be used to access secure surveys . My understanding is you can generate the token and use it to bypass the login screen but it does nt seem to work for me  

Integrate with other apps—ArcGIS Survey123 | Documentation 

0 Kudos
1 Solution

Accepted Solutions
JamesTedrick
Esri Esteemed Contributor

Hi Paul,

Thanks for the details.  I would not expect that to work for the Survey123 web form.  As opposed to direct REST requests, the referrer would be important; that should be the survey123 web form.  Additionally, if you are using a custom app, make sure that the survey123 website is listed in the list of valid redirect_uris.

View solution in original post

18 Replies
LynseyBlackburn
Esri Contributor

Hi Paul, 

Are you trying to access a survey through the web app?

Could you share the syntax you are using to try and access this survey?

Are you working with Portal for ArcGIS?

Where are you generating this token?

-Lynsey

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi Lynsey

I am trying to access a web form which was created on survey123 connect. I generate the token in integromat using the HTTP module and the rest API to generate a token , then i generate an email with the following link embedded.

https://survey123.arcgis.com/share/xxxxxxxxxxxxxxxxx?mode=edit&globalId=xxxxxxxxx&token=xxxxxxxxx 

i have tried it with the oath2 method using the client id and secret and it seems to open up the web form form for a second but it closes it straight away and i am met with the error message "The survey does not exist or is not accessible"

i then tried it using this method Generate Token—ArcGIS REST API | ArcGIS for Developers  and it links to survey123 but the page just constantly refreshes 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Paul,

Can you provide details on the token generation?  What are the parameters (referrer, etc.) you are using?

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi James 

I am using the following for the generate token

username=xxxxxx

password=xxxxxxx

f=pjson

referer=https://www.arcgis.com

for the oath2 option i used the following 

  • client_id
  • Client_secret
  • grant_type
    • client_credentials

the token generates successfully for both and passes to the url i also have it working successfully in other scenarios to add features and update layers so i am pretty sure its the right way of doing it. 

0 Kudos
JamesTedrick
Esri Esteemed Contributor

Hi Paul,

Thanks for the details.  I would not expect that to work for the Survey123 web form.  As opposed to direct REST requests, the referrer would be important; that should be the survey123 web form.  Additionally, if you are using a custom app, make sure that the survey123 website is listed in the list of valid redirect_uris.

PaulSweeney3
Occasional Contributor III

Hi James Tedrick

Thanks that appears to be working now. I updated the referer to the form url in option 1 above and it seems to be opening correctly now. In relation to the redirect uris for the second option I did nt try that yet but when I do I will try to provide an update. 

0 Kudos
PaulSweeney3
Occasional Contributor III

Hi James Tedrick

Re visiting this again as i seem to have another issue, is there a reason the link i generate with the token would open in a mobile browser fine (on an android device) and not on a desktop browser. On the desktop it brings me to the arcgis online login screen and when i sign in the page just constantly refreshes the green survey123 loading bar with no end result . when i open the same link in my mobile device it works fine. I have tried it on multiple desktop browsers 

Thanks 

0 Kudos
CarlosRuano1
Esri Contributor

Hi I have the same problem, but I just happen two days ago, I have a custom app with token generation but suddenly, stop working and now only show me: The survey does not exist or is not accessible.

Could you help me??

0 Kudos
PaulSweeney3
Occasional Contributor III

Carlos Ruano Are you saying it only works for a mobile browser and not on the desktop ? 

0 Kudos