<?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: Secured service with token and dynamic insert in map in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38883#M931</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not certain what you mean by ip solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var rootURL:String=mx.core.Application.application.url.substr(0,mx.core.Application.application.url.indexOf("/",8));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var expir:int=1440;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var param:Object={"request":"gettoken","username":username, "password": password, "clientid":"ref."+rootURL,"expiration":expir}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do get a token back, but it's invalid.&amp;nbsp; I get warnings from flashbuilder on my mx.core.Application as well.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder if it is 10.1.&amp;nbsp; This current project does not really need to be secure, but I want to get this right so I can secure projects that require security.&amp;nbsp; Am I losing the security by not passing the clientID and expiration?&amp;nbsp; I have time limits set on tokens on the server side.&amp;nbsp; I did not use tokens before 10.1 so I'm not certain what settings have changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your info on SSL certificates.&amp;nbsp; It's what I had assumed, but it was nice to know I wasn't assuming wrong!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 18 Apr 2013 12:48:53 GMT</pubDate>
    <dc:creator>KathleenBrenkert</dc:creator>
    <dc:date>2013-04-18T12:48:53Z</dc:date>
    <item>
      <title>Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38872#M920</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm trying, in a simple example, to add a secured service with token in a map.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;At the moment I don't use https protocol. All is on http.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That's my workflow of the mxml file, all this steps are made in actionscript:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. When the application is creationComplete I make a request to the token service with user, pass, clientid and expiration time&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;2. When the token is generated, I have the correct string in my handler and with this token I create a new ArcGISDynamicMapServiceLayer with the url and token.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;3. Add the new object to the map with addLayer&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var token:String = RequestToken('user','password');&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;var layerProtected:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://server/arcgis/rest/services/service1/MapServer" rel="nofollow" target="_blank"&gt;http://server/arcgis/rest/services/service1/MapServer&lt;/A&gt;&lt;SPAN&gt;", null, token);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mappa.addLayer(layerProtected);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;--&amp;gt; result: no secured service on my map. Error token not valid &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the response viewed with Firebug when I try to make the request to the protected service:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{"error":{"code":498,"message":"Invalid token","details":[]}}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But If I try to use the previous generated token in a simple mxml file with tags &amp;lt;esri:ArcGISDynamicMapServiceLayer and I insert the token in the attribute of the above tag the map is shown...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;lt;esri:ArcGISDynamicMapServiceLayer url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://server/arcgis/rest/services/service1/MapServer" rel="nofollow" target="_blank"&gt;http://server/arcgis/rest/services/service1/MapServer&lt;/A&gt;&lt;SPAN&gt;" token="CRnSk2v0ukFyP87T97Yh_10IQCLhj6uBBlSwwmVXPszYSxDMBM4FdejQzqPWDEJNuzuTyt1pteZHgO0jTxvIKXG_6J4Mq0QQJoU1KQWbpEw."/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;What's the issue? What's my mistake? Have you any suggestions?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 May 2010 05:58:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38872#M920</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2010-05-28T05:58:16Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38873#M921</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Giosia,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; The likely issue is that your RequestToken function is not returning before your code attempts to use that token string. Try using the actual token string in you action script code and see if that works if you don't like that then listen for your RequestToken function to return before you add your ArcGISDynamicMapServiceLayer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 May 2010 11:43:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38873#M921</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-05-28T11:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38874#M922</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;you can not use the token string variable after the code line "var token:String = RequestToken('user','password');" becouse the request of&amp;nbsp; token is&amp;nbsp; asynchronous. you must use this variable in the result function of the listener event&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 May 2010 18:37:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38874#M922</guid>
      <dc:creator>GuillermoMarinez</dc:creator>
      <dc:date>2010-05-28T18:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38875#M923</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thank for the response Robert and Guillermo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've made a mistake with the code copy/paste. The object with the protected map is created in the result handler of the RequestToken function and at this moment I have the token that I use in dynamic mode and with the esri tag but the error is always invalid token. Did it work in your application?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank for your replies...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;regards&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 07:22:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38875#M923</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2010-05-31T07:22:58Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38876#M924</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Giosia,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have not had any issue using secure map services. I don't use the RequestToken function though because you then are putting your user name and password into the code, and that is not very secure.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 May 2010 21:27:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38876#M924</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2010-05-31T21:27:32Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38877#M925</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Robert,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thank for your reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't insert user and password in the code. My goal is to have a login screen with a php service that make a call to ldaps repository. All is made over https protocol. With the possibility to use dynamically token service in the ags I don't need to store in the code the token but add the generated code automatically.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The problem is that doesn't work dynamically... and I don't understand why... Nobody have an idea??? Esri guru's?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I post my test page... if any have an idea... it's apprecieated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now is all in http protocol but in the future all goes to https...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;&amp;lt;mx:Application xmlns:mx="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.adobe.com/2006/mxml" rel="nofollow" target="_blank"&gt;http://www.adobe.com/2006/mxml&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; xmlns:esri="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://www.esri.com/2008/ags" rel="nofollow" target="_blank"&gt;http://www.esri.com/2008/ags&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; pageTitle="Example - ArcGIS API for Flex connecting to a dynamic AGS service"&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; creationComplete="init()"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;mx:Script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;![CDATA[&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import mx.binding.utils.BindingUtils;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import mx.rpc.http.HTTPService;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import mx.controls.Alert;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import mx.rpc.events.ResultEvent;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import mx.rpc.events.FaultEvent;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; private var theToken:String;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; private function init():void {&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; RequestToken('ldapUser','ldapPassword'); // this value will be replaced with data from acces form&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; public function RequestToken(username:String, password:String):void {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; var http:HTTPService = new HTTPService();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; http.addEventListener( ResultEvent.RESULT, tokenResultHandler );&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; http.addEventListener( FaultEvent.FAULT, faultHandler );&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; http.url = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://*******:8399/arcgis/tokens?request=gettoken&amp;amp;username=" rel="nofollow" target="_blank"&gt;http://*******:8399/arcgis/tokens?request=gettoken&amp;amp;username=&lt;/A&gt;&lt;SPAN&gt;"+ username +"&amp;amp;password="+ password +"&amp;amp;clientid=ref.&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://***.***.ti.ch&amp;amp;expiration=1440" rel="nofollow" target="_blank"&gt;http://***.***.ti.ch&amp;amp;expiration=1440&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; http.method = "GET";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; http.resultFormat = "text";&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; http.send();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; function faultHandler(event:FaultEvent):void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Alert.show(event.fault.toString());&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; function tokenResultHandler(event:ResultEvent):void&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; {&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; theToken = event.result.toString();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Alert.show(theToken);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // adding secured service&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; // this don't work ...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; var mProt:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://*******:8399/arcgis/rest/services/prova2/MapServer" rel="nofollow" target="_blank"&gt;http://*******:8399/arcgis/rest/services/prova2/MapServer&lt;/A&gt;&lt;SPAN&gt;", null, theToken);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; mappa.addLayer(mProt);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; }&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; ]]&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;/mx:Script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;esri:Map id="mappa"&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; &amp;lt;esri:ArcGISDynamicMapServiceLayer url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://*******:8399/arcgis/rest/services/basemap/LyrCantonePolitico/MapServer" rel="nofollow" target="_blank"&gt;http://*******:8399/arcgis/rest/services/basemap/LyrCantonePolitico/MapServer&lt;/A&gt;&lt;SPAN&gt;" /&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;!-- this works ... --&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt; &amp;lt;esri:ArcGISDynamicMapServiceLayer url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://*******:8399/arcgis/rest/services/prova/MapServer" rel="nofollow" target="_blank"&gt;http://*******:8399/arcgis/rest/services/prova/MapServer&lt;/A&gt;&lt;SPAN&gt;" token="VN3MlX0Tl2sN1rEJv-Qpud-iUkQSRuDjZIznW4JWTY87EqeBwzYD5IY7PjlIJDbQfjNMJi6KPv1PztpF7wjLuQ.."/&amp;gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;/esri:Map&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;/mx:Application&amp;gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jun 2010 05:42:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38877#M925</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2010-06-01T05:42:03Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38878#M926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Not sure if this will be your answer, but it is something else to try...&amp;nbsp; This is something that I received from ESRI-Char&amp;nbsp; about this when I was trying to grab a token programmatically.&amp;nbsp; I haven't been able to try it yet so I cannot tell you if it works:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;From Saurbh at ESRI:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;"Ok, the error that I was getting was due to the FlashVersion I have installed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, apparently, there is a security issue with Flash 9.0.124 that requires the following line to be added to the CrossDomain.xml file:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;allow-http-request-headers-from domain=�?�*�?� headers=�?�SOAPAction�?�/&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://dotanything.wordpress.com/2008/08/11/flex-security-error-accessing-url-or-channelsecurityerror/"&gt;http://dotanything.wordpress.com/2008/08/11/flex-security-error-accessing-url-or-channelsecurityerror/&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; "&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Please let me know if this works for you!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Carmen Durham&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;City of Greenville, SC&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jun 2010 11:39:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38878#M926</guid>
      <dc:creator>CarmenDurham</dc:creator>
      <dc:date>2010-06-01T11:39:46Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38879#M927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Carmen,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;thanks for your suggestion. I've tried with your crossdomain.xml idea but with this code nothing works... I use flash 10 with flex 3.5.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think the problem is in the api, because the generated token works properly if I insert it in the mxml tag and in actionscript normally after it generation (in 2nd time) but if I generate the token on the fly and I add the new token generated return token is invalid (viewed with firebugs).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Others idea?? Thank you 4 all&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jun 2010 06:55:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38879#M927</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2010-06-02T06:55:44Z</dc:date>
    </item>
    <item>
      <title>[SOLVED] Secured service with token and dynamic insert in map (ags 9.3.1 sp1 - java)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38880#M928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt; Hi Carmen,&amp;nbsp; &lt;BR /&gt;thanks for your suggestion. I've tried with your crossdomain.xml idea but with this code nothing works... I use flash 10 with flex 3.5.&amp;nbsp; &lt;BR /&gt;I think the problem is in the api, because the generated token works properly if I insert it in the mxml tag and in actionscript normally after it generation (in 2nd time) but if I generate the token on the fly and I add the new token generated return token is invalid (viewed with firebugs).&amp;nbsp; &lt;BR /&gt; &lt;BR /&gt;Others idea?? Thank you 4 all&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi everybody,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've found the problem. I don't know why but I explain you my solution to the problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My configuration is ArcGis Server 9.3.1 SP1 Java version with token authentication on ldap server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Like the code posted above, when I have founded a token I made an alert. In the debug mode I've seen the same string. And my focus wasn't on the token string. This is my big mistake...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;To solve the problem with this error code&lt;SPAN style="font-family:&amp;quot;Courier New&amp;quot;;"&gt; {"error":{"code":498,"message":"Invalid token","details":[]}}&lt;/SPAN&gt; I've added a simple trim function before set the theToken variable:&lt;BR /&gt;&lt;SPAN style="font-family:&amp;quot;Courier New&amp;quot;;"&gt;theToken = StringUtil.trim(event.result.toString());&lt;/SPAN&gt; and now work all ok&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See my test code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:esri="http://www.esri.com/2008/ags"
&amp;nbsp;&amp;nbsp;&amp;nbsp; pageTitle="Example - ArcGIS API for Flex connecting to a dynamic secured AGS service"
&amp;nbsp;&amp;nbsp;&amp;nbsp; initialize="init()"&amp;gt;

 &amp;lt;mx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[
&amp;nbsp;&amp;nbsp; import mx.utils.StringUtil;
&amp;nbsp;&amp;nbsp; import flash.utils.setTimeout;
&amp;nbsp;&amp;nbsp; import mx.binding.utils.BindingUtils;
&amp;nbsp;&amp;nbsp; import mx.rpc.http.HTTPService;
&amp;nbsp;&amp;nbsp; import mx.controls.Alert;
&amp;nbsp;&amp;nbsp; import mx.rpc.events.ResultEvent;
&amp;nbsp;&amp;nbsp; import mx.rpc.events.FaultEvent;
&amp;nbsp;&amp;nbsp; import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;

&amp;nbsp;&amp;nbsp; private var theToken:String;

&amp;nbsp;&amp;nbsp; private function init():void {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var unsecuredBaseMap:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://******/arcgis/rest/services/*****/MapServer");
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(unsecuredBaseMap);

&amp;nbsp;&amp;nbsp;&amp;nbsp; RequestToken('ldapUser','ldapPassword');
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp; public function RequestToken(username:String, password:String):void {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var http:HTTPService = new HTTPService();
&amp;nbsp;&amp;nbsp;&amp;nbsp; // register event handlers (resultHandler and faultHandler functions)
&amp;nbsp;&amp;nbsp;&amp;nbsp; http.addEventListener( ResultEvent.RESULT, tokenResultHandler );
&amp;nbsp;&amp;nbsp;&amp;nbsp; http.addEventListener( FaultEvent.FAULT, faultHandler );

&amp;nbsp;&amp;nbsp;&amp;nbsp; http.url = "http://******/arcgis/tokens?request=gettoken&amp;amp;username="+ username +"&amp;amp;password="+ password&amp;nbsp; +"&amp;amp;clientid=ref.http://******.ti.ch&amp;amp;expiration=1440";

&amp;nbsp;&amp;nbsp;&amp;nbsp; http.method = "GET";
&amp;nbsp;&amp;nbsp;&amp;nbsp; http.resultFormat = "text";

&amp;nbsp;&amp;nbsp;&amp;nbsp; http.send();

&amp;nbsp;&amp;nbsp;&amp;nbsp; function faultHandler(event:FaultEvent):void
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show(event.fault.toString());
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; function tokenResultHandler(event:ResultEvent):void
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; theToken = StringUtil.trim(event.result.toString());
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; caricaLayerProtetti();
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp; private function caricaLayerProtetti():void {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var protectedMap1:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://******/arcgis/rest/services/*****/MapServer");
&amp;nbsp;&amp;nbsp;&amp;nbsp; protectedMap1.token = theToken;
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(protectedMap1);

&amp;nbsp;&amp;nbsp;&amp;nbsp; var protectedMap2:ArcGISDynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://******/arcgis/rest/services/*****/MapServer");
&amp;nbsp;&amp;nbsp;&amp;nbsp; protectedMap2.token = theToken;
&amp;nbsp;&amp;nbsp;&amp;nbsp; map.addLayer(protectedMap2);
&amp;nbsp;&amp;nbsp; }

&amp;nbsp; ]]&amp;gt;
 &amp;lt;/mx:Script&amp;gt;

 &amp;lt;mx:Label text="Java" fontSize="14"/&amp;gt;
 &amp;lt;esri:Map id="map" /&amp;gt;
&amp;lt;/mx:Application&amp;gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:30:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38880#M928</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2021-12-10T21:30:31Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38881#M929</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't yet have an ssl certificate, although I am planning to get that part taken care of soon.&amp;nbsp; I have used the suggested methods above and at one point "I swear" it was working.&amp;nbsp; Now that I have programed the rest of my site it has quit working.&amp;nbsp; I am at Server 10.1.&amp;nbsp; If I send:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&lt;SPAN&gt;http.url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://xxxxxxx/arcgis/tokens/arcgis/tokens?request=gettoken&amp;amp;username=" rel="nofollow" target="_blank"&gt;http://xxxxxxx/arcgis/tokens/arcgis/tokens?request=gettoken&amp;amp;username=&lt;/A&gt;&lt;SPAN&gt;"+username+"&amp;amp;password="+password;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I get a valid token.&amp;nbsp; If I add clientid or expiration to this url, I get invalid tokens.&amp;nbsp; Am I getting invalid tokens b/c I don't yet have the certificate set up? or are the issues with my security settings on the service or server side? or by any chance is this just how it works at 10.1?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, can anyone tell me if I set up the SSL will it affect my nonsecure services.&amp;nbsp; Or in otherwords, once I get the SSL certificate running is it going to shut down my sites that are not using tokens.&amp;nbsp; Might seem like a silly question, but I've made assumptions before and I am fumbling through this security stuff.&amp;nbsp; Thanks in advance!!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 11:27:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38881#M929</guid>
      <dc:creator>KathleenBrenkert</dc:creator>
      <dc:date>2013-04-18T11:27:48Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38882#M930</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I didn't checked this token request with 10.1 because we still on 10 now. I don't think that your problem are about ssl... I think that your request isn't correct or the clientid isn't good. Try to check a ip solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;With ssl certificate you encrypt comunication between client and server and you don't close other services that are unprotected... For close all service you need to apply security to all services. I hope that I've answered to your question.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;I don't yet have an ssl certificate, although I am planning to get that part taken care of soon.&amp;nbsp; I have used the suggested methods above and at one point "I swear" it was working.&amp;nbsp; Now that I have programed the rest of my site it has quit working.&amp;nbsp; I am at Server 10.1.&amp;nbsp; If I send:&lt;BR /&gt;http.url="http://xxxxxxx/arcgis/tokens/arcgis/tokens?request=gettoken&amp;amp;username="+username+"&amp;amp;password="+password;&lt;BR /&gt;&lt;BR /&gt;I get a valid token.&amp;nbsp; If I add clientid or expiration to this url, I get invalid tokens.&amp;nbsp; Am I getting invalid tokens b/c I don't yet have the certificate set up? or are the issues with my security settings on the service or server side? or by any chance is this just how it works at 10.1?&amp;nbsp; &lt;BR /&gt;&lt;BR /&gt;Also, can anyone tell me if I set up the SSL will it affect my nonsecure services.&amp;nbsp; Or in otherwords, once I get the SSL certificate running is it going to shut down my sites that are not using tokens.&amp;nbsp; Might seem like a silly question, but I've made assumptions before and I am fumbling through this security stuff.&amp;nbsp; Thanks in advance!!&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 11:34:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38882#M930</guid>
      <dc:creator>GiosiaPoma</dc:creator>
      <dc:date>2013-04-18T11:34:22Z</dc:date>
    </item>
    <item>
      <title>Re: Secured service with token and dynamic insert in map</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38883#M931</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm not certain what you mean by ip solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've used this: &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var rootURL:String=mx.core.Application.application.url.substr(0,mx.core.Application.application.url.indexOf("/",8));&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var expir:int=1440;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var param:Object={"request":"gettoken","username":username, "password": password, "clientid":"ref."+rootURL,"expiration":expir}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do get a token back, but it's invalid.&amp;nbsp; I get warnings from flashbuilder on my mx.core.Application as well.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I wonder if it is 10.1.&amp;nbsp; This current project does not really need to be secure, but I want to get this right so I can secure projects that require security.&amp;nbsp; Am I losing the security by not passing the clientID and expiration?&amp;nbsp; I have time limits set on tokens on the server side.&amp;nbsp; I did not use tokens before 10.1 so I'm not certain what settings have changed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you for your info on SSL certificates.&amp;nbsp; It's what I had assumed, but it was nice to know I wasn't assuming wrong!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Apr 2013 12:48:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/secured-service-with-token-and-dynamic-insert-in/m-p/38883#M931</guid>
      <dc:creator>KathleenBrenkert</dc:creator>
      <dc:date>2013-04-18T12:48:53Z</dc:date>
    </item>
  </channel>
</rss>

