<?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: using secure service for Geoprocessing widget input parameter in ArcGIS Web AppBuilder Questions</title>
    <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107508#M21450</link>
    <description>&lt;P&gt;Thank you for the response. I am generating the token in the task itself.&amp;nbsp; The account generating the token has access to the service, yes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The geoprocessing task is being used by the geoprocessing widget in Web Appbuilder.&amp;nbsp; If it were being used in a custom javascript application, this would not be a problem because it works just fine if I use the URL to a secured service as an input parameter.&amp;nbsp; The trouble arises when the user selects a layer from the ESRI webmap as an input (in web appbuilder).&amp;nbsp; When this happens, the tool crashes immediately.&amp;nbsp; Not sure if there's a way around this.&lt;/P&gt;&lt;P&gt;My code looks fairly similar to that but it's never getting to the apply edits stage at this point.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Oct 2021 14:11:49 GMT</pubDate>
    <dc:creator>NickSwartz</dc:creator>
    <dc:date>2021-10-14T14:11:49Z</dc:date>
    <item>
      <title>using secure service for Geoprocessing widget input parameter</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107317#M21446</link>
      <description>&lt;P&gt;I have created a geoprocessing service using Python and the ArcREST API that manipulates data in a secured service.&lt;/P&gt;&lt;P&gt;The problem is that when i try to have the user select a layer on the map (if it comes from a secured feature service).&amp;nbsp; I get the following error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NickSwartz_0-1634160036567.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/25150i6721E4D71E981040/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NickSwartz_0-1634160036567.png" alt="NickSwartz_0-1634160036567.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I can get around this by having the user supply the URL to the service as a string.&amp;nbsp; The script generates a token to use the apply edits feature of the REST API, but if I don't use a string parameter the script crashes immediately, even though the token is generated prior to the parameter ever being used.&amp;nbsp; However, users rarely know the URL of the services their editing and want to be able to select things straight off of the map. This is a requirement of the client for whom I am building this.&lt;/P&gt;&lt;P&gt;When I use an unsecured service, the parameter comes through in the script as a string value (the URL of the service) and the script runs just fine.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas???&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!!!&lt;/P&gt;</description>
      <pubDate>Wed, 13 Oct 2021 21:24:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107317#M21446</guid>
      <dc:creator>NickSwartz</dc:creator>
      <dc:date>2021-10-13T21:24:36Z</dc:date>
    </item>
    <item>
      <title>Re: using secure service for Geoprocessing widget input parameter</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107373#M21447</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/355270"&gt;@NickSwartz&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Some thoughts and questions below.&lt;/P&gt;&lt;P&gt;My initial thoughts are that you may have an issue with data types and/or access from a server/service/user perspective.&lt;/P&gt;&lt;P&gt;Are you passing the user's token to the geoprocessing service or are you generating the token within your Geoprocessing Task?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the account that generates the token have access to the Service?&amp;nbsp;&lt;/P&gt;&lt;P&gt;What application are you using to invoke the Geoprocessing Task?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does the Geoprocessing Server have access to the Target Service?&lt;/P&gt;&lt;P&gt;Are you determining if the parsed input URL from the client application is secured / not secured before sending your request?&amp;nbsp;&lt;SPAN&gt;Are you sending it via a POST method? It should look something like the below. You may need to white-list (filter) Non secure methods so that they ignore the 'token' parameter.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import json
import requests
ft_url = "htts://...//arcgis/rest/services/.../FeatureServer/applyEdits"
edits = [ {
    "id" : 0,
    "adds" : [
      {
        "geometry" : {
    		    "x": -143.501,
    		    "y": 57.043000000000006
        },
        "attributes": {
          "datetime": 1272210710000,
          "depth": 31.100000000000001,
          "region": "Andreanof Islands, Aleutian Islands, Alaska" 
        } 
      },
      {
        "geometry": {
          "x": -72.865099999999927,
          "y": -37.486599999999953 
        },
        "attributes": {
          "datetime": 1272210142999,
          "depth": "40.x",
          "region": "Bio-Bio, Chile" 
        } 
      } 
    ],
    "updates":[],
    "deletes":[],
   }
]

token = getToken()# Your token function here

params = {
 'f' : 'json',
 'edits': json.dumps(edits),
 'token': token
}

response = requests.post(ft_url, data=params)
print (response.json())&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 01:30:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107373#M21447</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2021-10-14T01:30:59Z</dc:date>
    </item>
    <item>
      <title>Re: using secure service for Geoprocessing widget input parameter</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107508#M21450</link>
      <description>&lt;P&gt;Thank you for the response. I am generating the token in the task itself.&amp;nbsp; The account generating the token has access to the service, yes.&amp;nbsp;&lt;/P&gt;&lt;P&gt;The geoprocessing task is being used by the geoprocessing widget in Web Appbuilder.&amp;nbsp; If it were being used in a custom javascript application, this would not be a problem because it works just fine if I use the URL to a secured service as an input parameter.&amp;nbsp; The trouble arises when the user selects a layer from the ESRI webmap as an input (in web appbuilder).&amp;nbsp; When this happens, the tool crashes immediately.&amp;nbsp; Not sure if there's a way around this.&lt;/P&gt;&lt;P&gt;My code looks fairly similar to that but it's never getting to the apply edits stage at this point.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 14:11:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107508#M21450</guid>
      <dc:creator>NickSwartz</dc:creator>
      <dc:date>2021-10-14T14:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: using secure service for Geoprocessing widget input parameter</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107511#M21451</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="gui.PNG" style="width: 344px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/25193i43DB54A7401A9890/image-size/large?v=v2&amp;amp;px=999" role="button" title="gui.PNG" alt="gui.PNG" /&gt;&lt;/span&gt;When I set the input data to be a URL string, the tool works great.&amp;nbsp; It's only when they select the layer from the map that there is a problem.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 14:13:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107511#M21451</guid>
      <dc:creator>NickSwartz</dc:creator>
      <dc:date>2021-10-14T14:13:52Z</dc:date>
    </item>
    <item>
      <title>Re: using secure service for Geoprocessing widget input parameter</title>
      <link>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107732#M21455</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/355270"&gt;@NickSwartz&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the information.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is the geoprocessing service shared to the current user that is logged into the Web Application?&lt;/P&gt;&lt;P&gt;We can try determine the authorization error by seeing what the Geoprocessing Widget is trying to request by logging the browser interactions. Some options to log network requests&amp;nbsp;&lt;SPAN&gt;are:&lt;/SPAN&gt;&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Use the Web Browsers' developer tools (hit F12 to open), or&lt;/LI&gt;&lt;LI&gt;Use Fiddler 4 (which may require some setting up to proxy between your machine and your secured network so I won't go through this - a handy&amp;nbsp;web logging tool to explore in the future).&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;U&gt;Web Browser&lt;/U&gt;&lt;/P&gt;&lt;P&gt;Can you open up your Web Browser's developer tools (hit F12 for shortcut)&amp;nbsp; and go to you Network Tab. Open up your Web Application and just before you select and layer and execute your tool, clear the network log.&lt;/P&gt;&lt;P&gt;Run your steps and your developer tools should log the re&lt;SPAN&gt;quests.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Select Widget should send the Query and the Geoprocessing Widget should send an&amp;nbsp;&lt;EM&gt;execute.&amp;nbsp;&lt;/EM&gt;Select a request and view the body/request parameters and see if the package sent to the Geoprocessing Service matches what you have intended to send.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The execute package should have a token parameter. Test if the token works in incognito mode. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;The Geoprocessing Widget might also log it in the console tab so maybe check out what messages are in there too&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Hopefully this helps with understanding the WAB to GPService interaction.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LongDinh_1-1634249752002.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/25243iCAC4B5CEAAF3F863/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LongDinh_1-1634249752002.png" alt="LongDinh_1-1634249752002.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Oct 2021 22:26:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-web-appbuilder-questions/using-secure-service-for-geoprocessing-widget/m-p/1107732#M21455</guid>
      <dc:creator>LongDinh</dc:creator>
      <dc:date>2021-10-14T22:26:28Z</dc:date>
    </item>
  </channel>
</rss>

