<?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: Passing Token to Service using ARCGIS JavaScript 4.0 in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190604#M17597</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ideally, you'd want to use &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/index.html"&gt;OAuth&lt;/A&gt; or a&amp;nbsp;&lt;A href="https://github.com/esri/resource-proxy"&gt;Proxy&lt;/A&gt; to manage this for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really want to manage this, you can try using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#registerToken"&gt;IdentityManager.registerToken()&lt;/A&gt; method to register the token with the IdentityManager to it is available for future requests. Provide it with an object as specified and that should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#generateToken"&gt;IdentityManager.generateToken()&lt;/A&gt; method to help you create the token.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Sep 2016 15:15:11 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2016-09-09T15:15:11Z</dc:date>
    <item>
      <title>Passing Token to Service using ARCGIS JavaScript 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190603#M17596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my application, I'm trying to add a FeatureLayer to a map. &amp;nbsp;The FeatureLayer url requires a token, which is created when a user name and password are provided. &amp;nbsp;I don't want the user to have to enter the user name and password, so what I've done is create a method that sends the user name and password to our token service, which then returns the token. &amp;nbsp;I then pass the token to the FeatureLayer as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var map = new Map({&lt;BR /&gt; basemap: "streets",&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; slider: false&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;var view = new MapView({&lt;BR /&gt; container: "viewDiv",&lt;BR /&gt; center: [-77.007308, 38.875827],&lt;BR /&gt; zoom: 18,&lt;BR /&gt; map: map&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var supportFeatureLayer = new FeatureLayer({&lt;BR /&gt; &lt;BR /&gt; url: config.layers.support + "?token=" + GISToken,&lt;BR /&gt; token: GISToken,&lt;BR /&gt; &lt;BR /&gt;outFields: ["*"]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;map.add(supportFeatureLayer);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, I still get a "Sign In" prompt, despite that I see data being returned by the REST service, using IE's developer tools. &amp;nbsp;I've attached a screenshot. &amp;nbsp;Is this the correct way to pass a token to a REST service? &amp;nbsp;Is there no way to prevent the "Sign In" prompt returned by the service?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 15:02:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190603#M17596</guid>
      <dc:creator>CraigMoran</dc:creator>
      <dc:date>2016-09-09T15:02:43Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Token to Service using ARCGIS JavaScript 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190604#M17597</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ideally, you'd want to use &lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/identity-oauth-basic/index.html"&gt;OAuth&lt;/A&gt; or a&amp;nbsp;&lt;A href="https://github.com/esri/resource-proxy"&gt;Proxy&lt;/A&gt; to manage this for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you really want to manage this, you can try using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#registerToken"&gt;IdentityManager.registerToken()&lt;/A&gt; method to register the token with the IdentityManager to it is available for future requests. Provide it with an object as specified and that should work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-identity-IdentityManager.html#generateToken"&gt;IdentityManager.generateToken()&lt;/A&gt; method to help you create the token.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 15:15:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190604#M17597</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2016-09-09T15:15:11Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Token to Service using ARCGIS JavaScript 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190605#M17598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I do this:&lt;/P&gt;&lt;P&gt;&amp;nbsp; serviceURL + "layer/FeatureServer/1?f=json&amp;amp;token=" + token.read();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Where:&lt;/P&gt;&lt;P&gt;service url is ur rest service url and token.read() is a fx where i save the layer for future request.&lt;/P&gt;&lt;P&gt;The other way is doing it like odoe says but i havent tried.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I Hope it works for u &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 17:24:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190605#M17598</guid>
      <dc:creator>EvelynHernandez</dc:creator>
      <dc:date>2016-09-09T17:24:47Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Token to Service using ARCGIS JavaScript 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190606#M17599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;That's the thing, I can get the token and am already passing the token to the service like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var supportFeatureLayer = new FeatureLayer(OurRESTUrl&amp;nbsp;+ "?token=" + GISToken,{&lt;BR /&gt; &lt;BR /&gt;outFields: ["*"]&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've already found a way to get the token back from our token service URL. &amp;nbsp;The problem is that even when I pass it to the&amp;nbsp;&lt;SPAN&gt;FeatureLayer -- as described above -- I get a login screen. &amp;nbsp;When I look at the developer tools, I see a request being sent to our REST service URL (&lt;A class="link-titled" href="http://arcgis.ddot.dc.gov/arcgis/rest/services/Test/DCSignsAndMeters/FeatureServer/6?f=json&amp;amp;token=mE9rsU4yaSaGSnfgGas2o0dNCcwHcW1YIwzLazN4XgM." title="http://arcgis.ddot.dc.gov/arcgis/rest/services/Test/DCSignsAndMeters/FeatureServer/6?f=json&amp;amp;token=mE9rsU4yaSaGSnfgGas2o0dNCcwHcW1YIwzLazN4XgM."&gt;http://&amp;lt;REST_SERVICE_URL&amp;gt;?f=json&amp;amp;token=mE9rsU4yaSaGSnfgGas2o0…&lt;/A&gt;&amp;nbsp;), and I also see data being sent back like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;{"currentVersion":10.31,"id":6,"name":"TOA.Supports","type":"Feature Layer","description":"","copyrightText":"","defaultVisibility":true,"editFieldsInfo":{"creationDateField":"created_date","creatorField":"created_user","editDateField":"last_edited_date","editorField":"last_edited_user"},"ownershipBasedAccessControlForFeatures":null,"syncCanReturnChanges":true,"relationships":[{"id":1,"name":"TOA.Signs_O","relatedTableId":1,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":0,"name":"TOA.Signs_D","relatedTableId":0,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":3,"name":"TOA.Signs_P","relatedTableId":2,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":4,"name":"TOA.Signs_R","relatedTableId":3,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":5,"name":"TOA.Signs_S","relatedTableId":4,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":6,"name":"TOA.Signs_W","relatedTableId":5,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin","keyField":"GLOBALID","composite":true},{"id":7,"name":"Meters","relatedTableId":9,"cardinality":"esriRelCardinalityOneToMany","role":"esriRelRoleOrigin"....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So, the service is sending data something back to my application, but I still get a login window.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I saw this post --&lt;A class="link-titled" href="https://yujianmin.wordpress.com/2015/03/05/bypass-identitymanager-popup-in-esri-arcgis-javascript-api/" title="https://yujianmin.wordpress.com/2015/03/05/bypass-identitymanager-popup-in-esri-arcgis-javascript-api/"&gt;Bypass IdentityManager Popup in ESRI ArcGIS JavaScript API | River on Bridge...&lt;/A&gt;&amp;nbsp;-- but I after implementing the JavaScript code, I still get the login window.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt; &lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 17:40:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190606#M17599</guid>
      <dc:creator>CraigMoran</dc:creator>
      <dc:date>2016-09-09T17:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: Passing Token to Service using ARCGIS JavaScript 4.0</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190607#M17600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thats wrong, see how i put it in the example above.&lt;/P&gt;&lt;P&gt;And if u are adding more than one service, u need to do it for each one.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Sep 2016 18:53:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-token-to-service-using-arcgis-javascript-4/m-p/190607#M17600</guid>
      <dc:creator>EvelynHernandez</dc:creator>
      <dc:date>2016-09-09T18:53:17Z</dc:date>
    </item>
  </channel>
</rss>

