<?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 Problems with using token and javascript API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-using-token-and-javascript-api/m-p/325254#M29972</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'm implementing featurelayers from a companies arcgis server and until now I've been polled for username and password in the website I'm making. Its a webresource inside Dynamics so authentication is already handled. I see the arcgis server has the feature to create tokens at .../arcgis/tokens and I created one for my application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm unsure of what&amp;nbsp;client, as I have not declared it somewhere. I've tried;&lt;/P&gt;&lt;P&gt;- HTTP Referer with the address of the dynamics installation (something.crm3.dynamics.com)&lt;/P&gt;&lt;P&gt;- IP (ip of&amp;nbsp;&lt;SPAN&gt;something.crm3.dynamics.com)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Request IP (but that would not work as I'm doing the request from my work laptop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've implemented the token as stated in the documentation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var layer = new FeatureLayer({&lt;BR /&gt;&lt;SPAN&gt; url: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Ffoo.boo.no%2Farcgis%2Frest%2Fservices%2Fappname1%2Fappname2%2FMapServer%2F0" rel="nofollow" target="_blank"&gt;https://foo.boo.no/arcgis/rest/services/appname1/appname2/MapServer/0&lt;/A&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;BR /&gt; token: "&amp;lt;token&amp;gt;"&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;map.add(layer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &amp;lt;token&amp;gt; is the one generated from&amp;nbsp;&lt;SPAN&gt;.../arcgis/tokens.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried all the types of clients as tokens in the FeatureLayer request but nothing changes, I am still prompted to insert username and password.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have and idea? I need to replace the popup of username and password with the token in the background.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Sep 2017 08:01:20 GMT</pubDate>
    <dc:creator>LarsFagerbakke</dc:creator>
    <dc:date>2017-09-01T08:01:20Z</dc:date>
    <item>
      <title>Problems with using token and javascript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-using-token-and-javascript-api/m-p/325254#M29972</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'm implementing featurelayers from a companies arcgis server and until now I've been polled for username and password in the website I'm making. Its a webresource inside Dynamics so authentication is already handled. I see the arcgis server has the feature to create tokens at .../arcgis/tokens and I created one for my application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm unsure of what&amp;nbsp;client, as I have not declared it somewhere. I've tried;&lt;/P&gt;&lt;P&gt;- HTTP Referer with the address of the dynamics installation (something.crm3.dynamics.com)&lt;/P&gt;&lt;P&gt;- IP (ip of&amp;nbsp;&lt;SPAN&gt;something.crm3.dynamics.com)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;- Request IP (but that would not work as I'm doing the request from my work laptop)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I've implemented the token as stated in the documentation:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var layer = new FeatureLayer({&lt;BR /&gt;&lt;SPAN&gt; url: "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Ffoo.boo.no%2Farcgis%2Frest%2Fservices%2Fappname1%2Fappname2%2FMapServer%2F0" rel="nofollow" target="_blank"&gt;https://foo.boo.no/arcgis/rest/services/appname1/appname2/MapServer/0&lt;/A&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;BR /&gt; token: "&amp;lt;token&amp;gt;"&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;map.add(layer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The &amp;lt;token&amp;gt; is the one generated from&amp;nbsp;&lt;SPAN&gt;.../arcgis/tokens.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried all the types of clients as tokens in the FeatureLayer request but nothing changes, I am still prompted to insert username and password.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone have and idea? I need to replace the popup of username and password with the token in the background.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 08:01:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-using-token-and-javascript-api/m-p/325254#M29972</guid>
      <dc:creator>LarsFagerbakke</dc:creator>
      <dc:date>2017-09-01T08:01:20Z</dc:date>
    </item>
    <item>
      <title>Re: Problems with using token and javascript API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-using-token-and-javascript-api/m-p/325255#M29973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okey, got what I wanted!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This problem was solved by removing the token from the layer calls and using&amp;nbsp;IdentityManager ahead of all other calls instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The documentation is bad, but what I did was adding&amp;nbsp;IdentityManager by adding the reference to "esri/identity/IdentityManager" and the member&amp;nbsp;IdentityManager.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So at the start of the function() function (:-)) I simply added&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var token = {&lt;BR /&gt;&lt;SPAN&gt; 'server': '&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Ffoo.boo.no%2Farcgis%2Frest%2Fservices" rel="nofollow" target="_blank"&gt;https://foo.boo.no/arcgis/rest/services&lt;/A&gt;&lt;SPAN&gt;',&lt;/SPAN&gt;&lt;BR /&gt; 'token': '&amp;lt;token&amp;gt;',&lt;BR /&gt;};&lt;BR /&gt;IdentityManager.registerToken(token);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and then the rest of my logic. Problem solved. But I wish the documentation was a little more helpful with the IdentityManager object and why did not the token property of the FeatureLayer work?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2017 12:46:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problems-with-using-token-and-javascript-api/m-p/325255#M29973</guid>
      <dc:creator>LarsFagerbakke</dc:creator>
      <dc:date>2017-09-01T12:46:06Z</dc:date>
    </item>
  </channel>
</rss>

