<?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 windows auth AGS service to html table in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/windows-auth-ags-service-to-html-table/m-p/681069#M63464</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to create a simple html table from a windows auth secured arcgis service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried implementing&amp;nbsp;&lt;A href="https://community.esri.com/thread/212444" target="_blank"&gt;JSON (from Feature Layer Query) to html table&lt;/A&gt;&amp;nbsp;however I cant figure out consuming a secured service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The ags service is public facing with windows authentication&lt;/P&gt;&lt;P&gt;- The html page I'm creating is behind our firewall, so I can embed credentials if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I get with the code below is simply (401 unauthorized) on the rest service url... strangely if I open this url in a new tab it I get the json no problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was playing with various scenarios of a token embedded in the url parameters with no success...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated. I plan to use this functionality a lot...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt; Json to table using Ajax Jquery getJSON&amp;lt;/title&amp;gt;
 &amp;lt;script src="https://code.jquery.com/jquery-latest.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /&amp;gt;
 &amp;lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;div class="container"&amp;gt;
 &amp;lt;div class="table-responsive"&amp;gt;
 &amp;lt;h1&amp;gt; Cem Records&amp;lt;/h1&amp;gt;
 &amp;lt;br /&amp;gt;
 &amp;lt;table class="table table-bordered table-striped" id="cem_table"&amp;gt;
 &amp;lt;tr&amp;gt;
 &amp;lt;th&amp;gt;PlotID&amp;lt;/th&amp;gt;
 &amp;lt;th&amp;gt;First Name&amp;lt;/th&amp;gt;
 &amp;lt;th&amp;gt;Last Name&amp;lt;/th&amp;gt;
 &amp;lt;/tr&amp;gt;
 &amp;lt;/table&amp;gt;
 &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&amp;lt;script&amp;gt;
 $(document).ready(function() {
 $.getJSON(
 'https://**SERVERNAME**/arcgis/rest/services/Society/CemeteryEDIT/MapServer/0/query?where=1%3D1&amp;amp;outFields=*&amp;amp;token=7Z6eykyhOFplxb_vd9W2-fzTlFLaP0sWK68WvWe3dyLeVOQD3qPDHp5GNx43to_F&amp;amp;f=json',
 function(data) {
 var cem_data = '';
 console.info(data.features);
 $.each(data.features, function(key, value) {
 cem_data += '&amp;lt;tr&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.PLOTID + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.FIRST_NAME + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.LAST_NAME + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;tr&amp;gt;';
 });
 $('#cem_table').append(cem_data);
 });
 });
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 16:47:09 GMT</pubDate>
    <dc:creator>AwesomeEvan</dc:creator>
    <dc:date>2021-12-12T16:47:09Z</dc:date>
    <item>
      <title>windows auth AGS service to html table</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/windows-auth-ags-service-to-html-table/m-p/681069#M63464</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would like to create a simple html table from a windows auth secured arcgis service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried implementing&amp;nbsp;&lt;A href="https://community.esri.com/thread/212444" target="_blank"&gt;JSON (from Feature Layer Query) to html table&lt;/A&gt;&amp;nbsp;however I cant figure out consuming a secured service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- The ags service is public facing with windows authentication&lt;/P&gt;&lt;P&gt;- The html page I'm creating is behind our firewall, so I can embed credentials if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem I get with the code below is simply (401 unauthorized) on the rest service url... strangely if I open this url in a new tab it I get the json no problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was playing with various scenarios of a token embedded in the url parameters with no success...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated. I plan to use this functionality a lot...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;----------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;

&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt; Json to table using Ajax Jquery getJSON&amp;lt;/title&amp;gt;
 &amp;lt;script src="https://code.jquery.com/jquery-latest.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"&amp;gt;&amp;lt;/script&amp;gt;
 &amp;lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /&amp;gt;
 &amp;lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;

&amp;lt;body&amp;gt;
 &amp;lt;div class="container"&amp;gt;
 &amp;lt;div class="table-responsive"&amp;gt;
 &amp;lt;h1&amp;gt; Cem Records&amp;lt;/h1&amp;gt;
 &amp;lt;br /&amp;gt;
 &amp;lt;table class="table table-bordered table-striped" id="cem_table"&amp;gt;
 &amp;lt;tr&amp;gt;
 &amp;lt;th&amp;gt;PlotID&amp;lt;/th&amp;gt;
 &amp;lt;th&amp;gt;First Name&amp;lt;/th&amp;gt;
 &amp;lt;th&amp;gt;Last Name&amp;lt;/th&amp;gt;
 &amp;lt;/tr&amp;gt;
 &amp;lt;/table&amp;gt;
 &amp;lt;/div&amp;gt;
 &amp;lt;/div&amp;gt;

&amp;lt;/body&amp;gt;

&amp;lt;/html&amp;gt;
&amp;lt;script&amp;gt;
 $(document).ready(function() {
 $.getJSON(
 'https://**SERVERNAME**/arcgis/rest/services/Society/CemeteryEDIT/MapServer/0/query?where=1%3D1&amp;amp;outFields=*&amp;amp;token=7Z6eykyhOFplxb_vd9W2-fzTlFLaP0sWK68WvWe3dyLeVOQD3qPDHp5GNx43to_F&amp;amp;f=json',
 function(data) {
 var cem_data = '';
 console.info(data.features);
 $.each(data.features, function(key, value) {
 cem_data += '&amp;lt;tr&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.PLOTID + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.FIRST_NAME + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;td&amp;gt;' + value.attributes.LAST_NAME + '&amp;lt;/td&amp;gt;';
 cem_data += '&amp;lt;tr&amp;gt;';
 });
 $('#cem_table').append(cem_data);
 });
 });
&amp;lt;/script&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 16:47:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/windows-auth-ags-service-to-html-table/m-p/681069#M63464</guid>
      <dc:creator>AwesomeEvan</dc:creator>
      <dc:date>2021-12-12T16:47:09Z</dc:date>
    </item>
  </channel>
</rss>

