<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problem with token used for Survey123 featureReport tool in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1170339#M42538</link>
    <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/423485"&gt;@Arnon&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The workaround was to retrieve the token after entering the credentials for the login process. If the credentials are accepted, the access token is returned as part of the URL fragment appended to the&amp;nbsp;&lt;SPAN&gt;redirect_uri&lt;/SPAN&gt; (See &lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/authentication.htm" target="_blank"&gt;&lt;EM&gt;https://developers.arcgis.com/rest/users-groups-and-items/authentication.htm&lt;/EM&gt;&lt;/A&gt;&lt;/SPAN&gt; for more details.)&lt;/P&gt;&lt;P&gt;I was developing in &amp;nbsp;nuxt.js, so in order to get the url string during the login…&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const tokenUrl = this.$route.fullPath&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And to retrieve the token…&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const parsedTokenUrl = tokenUrl.split('#')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const lstTokenUrlParams = parsedTokenUrl[1].split('&amp;amp;')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const token = lstTokenUrlParams[0].split('access_token=')[1]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
    <pubDate>Tue, 03 May 2022 20:03:42 GMT</pubDate>
    <dc:creator>PeterDelgado</dc:creator>
    <dc:date>2022-05-03T20:03:42Z</dc:date>
    <item>
      <title>Problem with token used for Survey123 featureReport tool</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1133511#M39756</link>
      <description>&lt;P&gt;I am trying to use the survey123&amp;nbsp;&lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/survey123/api-reference/rest/report/" target="_blank"&gt;feature report API&lt;/A&gt;&lt;/SPAN&gt; to generate reports programmatically with Javascript.&amp;nbsp; The idea is to create an application with an interface where the user fetches the report to download.&lt;/P&gt;&lt;P&gt;In order to create the reports, one of the required parameters is the token generated during the login session.&lt;/P&gt;&lt;P&gt;To generate the token, I’m using the “@esri/arcgis-rest-auth” module.&lt;/P&gt;&lt;P&gt;Another way that I tried for generating the token is through the ArcGIS REST API POST request with the “generateToken” method with the following specifications:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;request url: &lt;SPAN&gt;&lt;A href="https://www.arcgis.com/sharing/rest/generateToken?f=json" target="_blank"&gt;&lt;STRONG&gt;https://www.arcgis.com/sharing/rest/generateToken?f=json&lt;/STRONG&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;request parameters: username, password, referer. The referer used is the url of the survey form &lt;SPAN&gt;&lt;A href="https://survey123.arcgis.com/share/%3csurveyItemId" target="_blank"&gt;&lt;STRONG&gt;https://survey123.arcgis.com/share/&amp;lt;surveyItemId&lt;/STRONG&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;STRONG&gt;&amp;gt;&lt;/STRONG&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;With both token generating methods I get the same error when requesting a report. &lt;STRONG&gt;&lt;EM&gt;“Error: Could not generate report! An error occurred when rendering by the report engine. Failed to print map. Error: Failed to load feature layer: Invalid token.”&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Is there another way for generating a valid token? Is the error related to the current token generated or is the error related to something else?&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 18:22:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1133511#M39756</guid>
      <dc:creator>PeterDelgado</dc:creator>
      <dc:date>2022-01-13T18:22:32Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with token used for Survey123 featureReport tool</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1133664#M39764</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/477265"&gt;@PeterDelgado&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;That error seems like the report API is trying to generate the report and failing on generation maybe not so much on the initial API call. If you try running the report directly from the Survey123 web UI is the same error returned or does the report generate successfully there?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the report generates successfully from the Survey123 web UI try setting the referer to &lt;A href="https://www.arcgis.com" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jan 2022 22:54:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1133664#M39764</guid>
      <dc:creator>ZacharySutherby</dc:creator>
      <dc:date>2022-01-13T22:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with token used for Survey123 featureReport tool</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1134027#M39779</link>
      <description>&lt;P&gt;Hello @&lt;SPAN&gt;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/251557" target="_blank"&gt;ZacharySutherby&lt;/A&gt;&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;Running the report directly from the Survey123 web UI works fine. It generates the report without any problems or errors. I can also generate the report when I put the token hardcoded in my Javascript program. But I copy this token from the browser’s developer tools when I log in to the Survey123 web UI. So doing it manually I don’t have any problems. Doing it programmatically or automated is when I get the error.&lt;/P&gt;&lt;P&gt;I already tried setting the referer to &lt;SPAN&gt;&lt;A href="https://www.arcgis.com/" target="_blank"&gt;https://www.arcgis.com&lt;/A&gt;&lt;/SPAN&gt; when generating the token through the ArcGIS REST API POST request. I get the same error with that referer.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jan 2022 19:27:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1134027#M39779</guid>
      <dc:creator>PeterDelgado</dc:creator>
      <dc:date>2022-01-14T19:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with token used for Survey123 featureReport tool</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1168204#M42393</link>
      <description>&lt;P&gt;Hello &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/477265"&gt;@PeterDelgado&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you find a solution? I'm facing the same issue.&lt;/P&gt;&lt;P&gt;When I grab the token from the UI using Chrome' dev tools I'm able to produce a report using the API.&lt;/P&gt;&lt;P&gt;When I use a token generated by an ArcGIS API for python I can also produce a report.&lt;/P&gt;&lt;P&gt;But the token generated by &lt;SPAN&gt;&lt;A href="https://www.arcgis.com/sharing/generateToken" target="_blank"&gt;https://www.arcgis.com/sharing/generateToken&lt;/A&gt;&lt;/SPAN&gt; is failing.&lt;/P&gt;&lt;P&gt;Thanks, Arnon&lt;/P&gt;</description>
      <pubDate>Wed, 27 Apr 2022 05:50:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1168204#M42393</guid>
      <dc:creator>Arnon</dc:creator>
      <dc:date>2022-04-27T05:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with token used for Survey123 featureReport tool</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1170339#M42538</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/423485"&gt;@Arnon&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The workaround was to retrieve the token after entering the credentials for the login process. If the credentials are accepted, the access token is returned as part of the URL fragment appended to the&amp;nbsp;&lt;SPAN&gt;redirect_uri&lt;/SPAN&gt; (See &lt;SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/users-groups-and-items/authentication.htm" target="_blank"&gt;&lt;EM&gt;https://developers.arcgis.com/rest/users-groups-and-items/authentication.htm&lt;/EM&gt;&lt;/A&gt;&lt;/SPAN&gt; for more details.)&lt;/P&gt;&lt;P&gt;I was developing in &amp;nbsp;nuxt.js, so in order to get the url string during the login…&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const tokenUrl = this.$route.fullPath&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;And to retrieve the token…&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const parsedTokenUrl = tokenUrl.split('#')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const lstTokenUrlParams = parsedTokenUrl[1].split('&amp;amp;')&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;const token = lstTokenUrlParams[0].split('access_token=')[1]&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 03 May 2022 20:03:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/problem-with-token-used-for-survey123/m-p/1170339#M42538</guid>
      <dc:creator>PeterDelgado</dc:creator>
      <dc:date>2022-05-03T20:03:42Z</dc:date>
    </item>
  </channel>
</rss>

