<?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: How to work with Dynamic Token service? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684141#M63674</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you test your proxy page with the feature service url?&amp;nbsp;Here are some examples on how to validate your proxy installation and configuration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - Access your proxy page and validate the page without an url: https://&amp;lt;servername&amp;gt;/proxy.ashx?ping&lt;/P&gt;&lt;P&gt;2 - Test the proxy page with the feature service url:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;https://&amp;lt;servername&amp;gt;/proxy.ashx?&amp;lt;featureserviceurl&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 - Enable the proxy log file to investigate the error message while trying to acess the feature&amp;nbsp;service &lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;Use the ProxyConfig tag to specify property&lt;/SPAN&gt;.&amp;nbsp;&lt;STRONG style="color: #24292e; background-color: #ffffff; font-weight: 600;"&gt;logFile="proxylog.txt"&lt;/STRONG&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;: When a logFile is specified, the proxy will log messages to this file.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #24292e; background-color: #ffffff;"&gt;N.B.: The folder containing the logFile must be writable by the web server.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 27 Apr 2020 23:58:42 GMT</pubDate>
    <dc:creator>VictorCoelho</dc:creator>
    <dc:date>2020-04-27T23:58:42Z</dc:date>
    <item>
      <title>How to work with Dynamic Token service?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684140#M63673</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried all sorts of things before reaching out here, but I'm afraid I'm stuck.&amp;nbsp; I need to consume a feature layer service from a third party ESRI Portal site.&amp;nbsp; The service is secured using a Dynamic Token and I have been supplied a username and password to access the service.&amp;nbsp; If I simply use a browser to get to the REST endpoint of the service I get prompted to login, which I can and I can see the layers in the service listed, so I know the login works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is I can't find a complete walk-through of how to do this for the JS API and I've been unable to piece together the information I've found.&amp;nbsp; I'm using V3.28 of the API but I can change that if needed, and I'm using&amp;nbsp;Version 1.1.2 of the Proxy pages, and my app is dot net V4.5.&amp;nbsp; I'm familiar with the Proxy page and its use but not in the context of services with Dynamic Tokens.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, in my JavaScript I add a proxy rule for where the service is:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;esri.addProxyRule({&lt;BR /&gt;&amp;nbsp; &amp;nbsp; urlPrefix: "thedomain.co.uk",&lt;BR /&gt;&amp;nbsp; &amp;nbsp; proxyUrl: "proxy.ashx"&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;I think the problem then lies in the proxy config.&amp;nbsp; I've found various suggestions online, so what I have below may contain things that aren't required, or are just wrong:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&amp;lt;serverUrl url="https://&lt;SPAN&gt;thedomain&lt;/SPAN&gt;.co.uk"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; tokenServiceUri="http://&lt;SPAN&gt;thedomain&lt;/SPAN&gt;.co.uk/tokens/"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; matchAll="true"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; domain="&lt;SPAN&gt;thedomain&lt;/SPAN&gt;.co.uk"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; host="http://mydomain/"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; dynamicToken="True"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; username="portalUsername"&lt;BR /&gt;&amp;nbsp; &amp;nbsp; password="portalpassword"&lt;BR /&gt; &amp;gt;&amp;lt;/serverUrl&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No matter what I've tried, I keep getting prompted with a login box when I launch my API.&amp;nbsp; What I'm trying to achieve is adding the feature service to my map without a login box appearing - I'm expecting the proxy details to handle that as all request to the service will be going through the proxy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I missing something fundamental here?&amp;nbsp; If I had a working example to see then I can usually work things out from it, but I just haven't been able to find one.&amp;nbsp; Can anyone please point me to an end-to-end example or make suggestions here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you, Mark.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 13:10:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684140#M63673</guid>
      <dc:creator>MarkSmith</dc:creator>
      <dc:date>2020-04-27T13:10:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to work with Dynamic Token service?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684141#M63674</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mark,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did you test your proxy page with the feature service url?&amp;nbsp;Here are some examples on how to validate your proxy installation and configuration:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1 - Access your proxy page and validate the page without an url: https://&amp;lt;servername&amp;gt;/proxy.ashx?ping&lt;/P&gt;&lt;P&gt;2 - Test the proxy page with the feature service url:&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;https://&amp;lt;servername&amp;gt;/proxy.ashx?&amp;lt;featureserviceurl&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;3 - Enable the proxy log file to investigate the error message while trying to acess the feature&amp;nbsp;service &lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;Use the ProxyConfig tag to specify property&lt;/SPAN&gt;.&amp;nbsp;&lt;STRONG style="color: #24292e; background-color: #ffffff; font-weight: 600;"&gt;logFile="proxylog.txt"&lt;/STRONG&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;: When a logFile is specified, the proxy will log messages to this file.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;EM style="color: #24292e; background-color: #ffffff;"&gt;N.B.: The folder containing the logFile must be writable by the web server.&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Apr 2020 23:58:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684141#M63674</guid>
      <dc:creator>VictorCoelho</dc:creator>
      <dc:date>2020-04-27T23:58:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to work with Dynamic Token service?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684142#M63675</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Victor,&lt;BR /&gt;Thanks for your reply.&amp;nbsp; I know the proxy file works ok because I'm using it for credentials to access one of my own secured map services.&amp;nbsp; When I test using&amp;nbsp;https://&amp;lt;&lt;SPAN style="background-color: #ffffff; border: 0px;"&gt;servername&amp;gt;/proxy.ashx?&amp;lt;featureserviceurl&amp;gt; on my own secured service it works fine, but this third-party service from their Portal site gives me this error in a browser:&lt;/SPAN&gt;&lt;/P&gt;&lt;H2 style="color: maroon; font-weight: normal; font-size: 14pt;"&gt;&lt;EM&gt;The remote server returned an error: (401) Unauthorized.&lt;/EM&gt;&lt;/H2&gt;&lt;PRE style="color: #000000; background-color: #ffffcc; padding: 0.5em;"&gt;Line 560:        req.Referer = PROXY_REFERER; Line 561:        writeRequestPostBody(req, bytes);&lt;SPAN style="color: red;"&gt;Line 562:        return req.GetResponse();&lt;/SPAN&gt;Line 563:    } Line 564:&lt;/PRE&gt;&lt;P&gt;I added the log file to&amp;nbsp;&amp;lt;ProxyConfig as you suggested, but nothing gets written to it for the above error.&amp;nbsp; I deliberately made my secured service error to make sure the log file was working ok and it is.&lt;/P&gt;&lt;P&gt;Something else to mention, I have managed to access the tokens and make requests using dot net NTLM authentication, so I can actually tap into the service and deserialize the JSON to get to features using code behind, but I need to get this to work using JavaScript and the Proxy page.&amp;nbsp; I have been told (when using the dot net&amp;nbsp;&lt;SPAN&gt;NTLM authentication) that I must specify client=requestip like so:&amp;nbsp;request.AddParameter("client", "requestip").&amp;nbsp; So I was wondering if that has any bearing on the Proxy parameters which I'm currently not doing?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Apr 2020 12:33:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-work-with-dynamic-token-service/m-p/684142#M63675</guid>
      <dc:creator>MarkSmith</dc:creator>
      <dc:date>2020-04-28T12:33:51Z</dc:date>
    </item>
  </channel>
</rss>

