<?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 do I properly secure calls/layers in the javascript API using the token service in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-properly-secure-calls-layers-in-the/m-p/718827#M66748</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to use the Esri way then you can look at using the &lt;A href="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html"&gt;IdentityManager &lt;/A&gt;which will manage the token for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to do it yourself and keep the token off the client then you can use the proxy page to generate and add tokens to the requests as needed. To be more secure you should also restrict unauthenticated or unauthorized access to the proxy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a sample app for routing all secure requests through the server proxy at &lt;A href="http://arcmap.azurewebsites.net/"&gt;http://arcmap.azurewebsites.net/&lt;/A&gt; and the code is on GitHub &lt;A href="https://github.com/davetimmins/Joosh"&gt;https://github.com/davetimmins/Joosh&lt;/A&gt; if you want to take a look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Jul 2014 00:20:55 GMT</pubDate>
    <dc:creator>DaveTimmins</dc:creator>
    <dc:date>2014-07-09T00:20:55Z</dc:date>
    <item>
      <title>How do I properly secure calls/layers in the javascript API using the token service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-properly-secure-calls-layers-in-the/m-p/718826#M66747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Currently I'm working on an implementation where my web application (asp.net stack) communicates with an internal C# asmx web service which acts as a proxy to retrieve the key from the token service, store it in session, and pass it back as a cookie/json to the requesting client.&amp;nbsp; There is also logic in there to ensure they get back a token with integrity. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My problem is I am looking for a way to ensure that the cookie is safe.&amp;nbsp; I have the cookie set to HttpOnly and Secure.&amp;nbsp; The problem is of course I can't access the cookie via the javascript api.&amp;nbsp; Also due to security requirements appending the token to the url is not an option.&amp;nbsp; So I removed that and then just did the standard:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14048234319178843" jivemacro_uid="_14048234319178843" modifiedtitle="true"&gt;
&lt;P&gt;var token = {&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "server": "&amp;lt;internal domain hosting arcgis server&amp;gt;/arcgis/rest",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "userId": "&amp;lt;username&amp;gt;",&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "token": result.d.Token,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "ssl": false,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; "expires": result.d.Expires&lt;/P&gt;
&lt;P&gt;};&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;P&gt;kernel.id.registerToken(token);&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when after I add the layers and initialize everything, the map is blank and when I try to forward or reverse geocode I get the error "&lt;SPAN style="color: #ff0000; font-family: Consolas, 'Lucida Console', monospace; font-size: 12px;"&gt;Uncaught TypeError: Cannot read property 'wkid' of undefined"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a better way of using the token to secure calls and layers made in javascript.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Jul 2014 12:50:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-properly-secure-calls-layers-in-the/m-p/718826#M66747</guid>
      <dc:creator>DanielPritchett</dc:creator>
      <dc:date>2014-07-08T12:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: How do I properly secure calls/layers in the javascript API using the token service</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-properly-secure-calls-layers-in-the/m-p/718827#M66748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you want to use the Esri way then you can look at using the &lt;A href="https://developers.arcgis.com/javascript/jsapi/identitymanager-amd.html"&gt;IdentityManager &lt;/A&gt;which will manage the token for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to do it yourself and keep the token off the client then you can use the proxy page to generate and add tokens to the requests as needed. To be more secure you should also restrict unauthenticated or unauthorized access to the proxy.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a sample app for routing all secure requests through the server proxy at &lt;A href="http://arcmap.azurewebsites.net/"&gt;http://arcmap.azurewebsites.net/&lt;/A&gt; and the code is on GitHub &lt;A href="https://github.com/davetimmins/Joosh"&gt;https://github.com/davetimmins/Joosh&lt;/A&gt; if you want to take a look.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Jul 2014 00:20:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-do-i-properly-secure-calls-layers-in-the/m-p/718827#M66748</guid>
      <dc:creator>DaveTimmins</dc:creator>
      <dc:date>2014-07-09T00:20:55Z</dc:date>
    </item>
  </channel>
</rss>

