<?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: Connecting to secure map service within javascript app in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267216#M24692</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do I need to go down the route of having my own proxy? The agol proxy option only seems relevant for premium services as it asks for me to select geocoding etc, where as this is just viewing a map service.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;seems this process could be an awful lot easier&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Mar 2020 18:12:39 GMT</pubDate>
    <dc:creator>DarrylHilton</dc:creator>
    <dc:date>2020-03-02T18:12:39Z</dc:date>
    <item>
      <title>Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267214#M24690</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have read all kinds of help documentation on this subject but can't seem to find the best fit, or get any to work. I have written the javascript app below. The layer being used is secured as I would not want the contents being made available to everyone, except for people who are using the app. They will have already logged in to get this far so I just need the application to handle the logging in to get the map data back. (ie at the moment it asks for an ArcGIS server log in). I can find lots of information about accessing secure applications, but not specific layers within a javascript app...any help would be great.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;head&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;meta charset="utf-8"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;title&amp;gt;DH Test Map&amp;lt;/title&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;style&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; html, body, #viewDiv {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; padding: 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; margin: 0;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; height: 100%;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; width: 100%;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/style&amp;gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;lt;link rel="stylesheet" href="&lt;A href="https://js.arcgis.com/4.14/esri/themes/light/main.css"&gt;https://js.arcgis.com/4.14/esri/themes/light/main.css&lt;/A&gt;"&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;lt;script src="&lt;A href="https://js.arcgis.com/4.14/&amp;quot;&amp;gt;&amp;lt;/script"&gt;https://js.arcgis.com/4.14/"&amp;gt;&amp;lt;/script&lt;/A&gt;&amp;gt;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; &amp;lt;script&amp;gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; require([&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/WebMap",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "esri/views/MapView",&lt;BR /&gt;&amp;nbsp;"esri/layers/FeatureLayer",&lt;BR /&gt;&amp;nbsp;"esri/core/urlUtils",&lt;BR /&gt;&amp;nbsp;"esri/tasks/support/Query",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ], function(WebMap, MapView, FeatureLayer, urlUtils, Query) {&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var urlObject = urlUtils.urlToObject(document.location.href);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;runValidaty(urlObject);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var impactedPropertiesLayer = new FeatureLayer({&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;url: "&lt;A href="https://maps.doncaster.gov.uk/server/rest/services/TEST/AffectedPropertiesSecure/MapServer/0"&gt;https://MYENTERPRISESERVER/server/rest/services/TEST/AffectedPropertiesSecure/MapServer/0&lt;/A&gt;",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;definitionExpression:expression,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;popupTemplate: { title: "{UPRN}", content: "{ImpactLevel_ID}"},&lt;BR /&gt;&amp;nbsp;&amp;nbsp;});&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;impactedPropertiesLayer.when(function() {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;return impactedPropertiesLayer.queryExtent();&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}).then(function(response) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;view.goTo(response.extent);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;var webmap = new WebMap({&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;portalItem: {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; id: "1a409e5d6939452cbb27fee5f05a2140"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;});&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;var view = new MapView({&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;container: "viewDiv",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;map: webmap,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;zoom: 6&lt;BR /&gt;&amp;nbsp;&amp;nbsp;});&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;webmap.add(impactedPropertiesLayer)&lt;/P&gt;&lt;P&gt;&amp;nbsp;var expression;&lt;BR /&gt;&amp;nbsp;function runValidaty(UrlPropertiesObj){&lt;BR /&gt;&amp;nbsp;expression ="";&lt;BR /&gt;&amp;nbsp;Object.keys(UrlPropertiesObj.query).forEach(function(key,index) {&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;var objectValue = UrlPropertiesObj.query[key];&lt;BR /&gt;&amp;nbsp;if(objectValue){&lt;BR /&gt;&amp;nbsp;//first time round&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;if(parseInt(objectValue)){&lt;BR /&gt;&amp;nbsp;expression += key + "="+objectValue+"";&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;}else{&lt;BR /&gt;&amp;nbsp;expression += key + "='"+objectValue+"'";&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;var nextObj = Object.keys(UrlPropertiesObj.query)[index+ 1];&lt;BR /&gt;&amp;nbsp;&amp;nbsp;if(UrlPropertiesObj.query[nextObj]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;//yes there is a property in the next loop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;expression += "AND "&lt;BR /&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;});&lt;BR /&gt;&amp;nbsp;}&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; });&lt;BR /&gt;&amp;nbsp; &amp;lt;/script&amp;gt;&lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;BR /&gt;&amp;nbsp; &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 15:16:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267214#M24690</guid>
      <dc:creator>DarrylHilton</dc:creator>
      <dc:date>2020-03-02T15:16:43Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267215#M24691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Darryl,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;You would setup and use a proxy as discussed in this thread.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/236738-layer-is-using-proxy-when-set-to-visible-and-it-shouldnt-use-it-url-does-not-match-with-proxy-rules-arcgis-js-api-412"&gt;https://community.esri.com/thread/236738-layer-is-using-proxy-when-set-to-visible-and-it-shouldnt-use-it-url-does-not-match-with-proxy-rules-arcgis-js-api-412&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 15:23:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267215#M24691</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-03-02T15:23:04Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267216#M24692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do I need to go down the route of having my own proxy? The agol proxy option only seems relevant for premium services as it asks for me to select geocoding etc, where as this is just viewing a map service.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;seems this process could be an awful lot easier&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 18:12:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267216#M24692</guid>
      <dc:creator>DarrylHilton</dc:creator>
      <dc:date>2020-03-02T18:12:39Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267217#M24693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yep, your own proxy if you are going to be storing credentials for your secured service.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 18:41:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267217#M24693</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-03-02T18:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267218#M24694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is actually now the preferred method for storing credentials:&amp;nbsp;&lt;A class="link-titled" href="https://support.esri.com/en/technical-article/000017029" title="https://support.esri.com/en/technical-article/000017029"&gt;How To: Limit access to secured hosted services in ArcGIS Online for public-facing web applications&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We are trying to move away from the resource proxy. Storing credentials using the resource proxy for the purpose of bypassing authentication is against the Terms &amp;amp; Conditions. There was a little paragraph added to the &lt;A href="https://github.com/Esri/resource-proxy"&gt;github page&lt;/A&gt;:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;Ensure that you follow the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/terms/" rel="nofollow" style="color: #0366d6; background-color: #ffffff; text-decoration: none;"&gt;Terms &amp;amp; Conditions&lt;/A&gt;&lt;SPAN style="color: #24292e; background-color: #ffffff;"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;of the Esri systems and software that you are working with. In general, it is not permitted to embed credentials in a resource proxy for the purpose of bypassing Named User authentication (i.e. the principle that each end-user must have their own unique login). This is true both when using a resource proxy with ArcGIS Online as well as for ArcGIS Server sites federated as part of an ArcGIS Enterprise deployment&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Mar 2020 21:13:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267218#M24694</guid>
      <dc:creator>BenElan</dc:creator>
      <dc:date>2020-03-02T21:13:50Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267219#M24695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, thanks for the reply, but I don't think that is answering my issue. I have a layer published with ArcGIS server (also available via Portal) (currently secured so only I can see it) which I need to use in some javascript I have written (above) not in a web map template from ArcGIS Online which those instructions seem to refer too&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 10:08:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267219#M24695</guid>
      <dc:creator>DarrylHilton</dc:creator>
      <dc:date>2020-03-03T10:08:19Z</dc:date>
    </item>
    <item>
      <title>Re: Connecting to secure map service within javascript app</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267220#M24696</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got it this working using some of the elements in this documentation: &lt;A href="https://support.esri.com/en/technical-article/000017029"&gt;https://support.esri.com/en/technical-article/000017029&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In summary, rather than linking people around&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I published&amp;nbsp;a secure map service in ArcGIS Server&lt;BR /&gt;Hosted that service in Portal using my credentials&lt;BR /&gt;Limited use to that hosted service to the url of the ap accessing it&lt;BR /&gt;Made the hosted service public&lt;BR /&gt;Added the URL of the hosted service to my code&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Mar 2020 12:05:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/connecting-to-secure-map-service-within-javascript/m-p/267220#M24696</guid>
      <dc:creator>DarrylHilton</dc:creator>
      <dc:date>2020-03-03T12:05:41Z</dc:date>
    </item>
  </channel>
</rss>

