<?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 Secured Service access from a Federated ArcGIS Server using JS API in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-service-access-from-a-federated-arcgis/m-p/1082436#M74010</link>
    <description>&lt;P&gt;In our organization we use a federated ArcGIS Server with Portal.&lt;BR /&gt;I'm consuming a secured REST service URL in a JavaScript.&lt;BR /&gt;application. I'm able to generate the token for accessing the service in the JavaScript application only with the PSA (ArcGIS Server) account.&lt;/P&gt;&lt;OL class="lia-list-style-type-upper-alpha"&gt;&lt;LI&gt;I tried with the credentials of portal administrator account for acquiring token for the secured URL, but i 'm not aware of how to access the Secured URL from the token generated from PORTAL&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var tokenvalue = $.ajax({
                type: "POST",
                url: "https://[mydomain]/server/tokens/generateToken",
                data: {
                    username: username,
                    password: password,
                    client: "requestip",
                    expiration: '120',
                    f: "json"
                },
                dataType: "json"
            });
            if (tokenvalue) {
                tokenvalue
                    .success(function (response){
                        if (response.token) {
	          console.log(tokenvalue)
                            IdentityManager.registerToken({
                                server: "https://[mydoamin]/server/rest/services",
                                token: response.token
                            });
                            console.log(response.token);
                            var layerUrl = "https://[mydomain]/server/rest/services/Landuse/MapServer";
                            var layer = new MapImageLayer({
                                url: layerUrl
                            });
                            map.add(layer);
                        }
                    })​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is it only possible to acquire token from the federated server only using the PSA or is there any other way to acquire the Token.&lt;/LI&gt;&lt;LI&gt;Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved &amp;amp;&amp;nbsp;point me to some working examples.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm really stuck in this concept and anyone can explain&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jul 2021 09:05:42 GMT</pubDate>
    <dc:creator>MANESK</dc:creator>
    <dc:date>2021-07-24T09:05:42Z</dc:date>
    <item>
      <title>Secured Service access from a Federated ArcGIS Server using JS API</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-service-access-from-a-federated-arcgis/m-p/1082436#M74010</link>
      <description>&lt;P&gt;In our organization we use a federated ArcGIS Server with Portal.&lt;BR /&gt;I'm consuming a secured REST service URL in a JavaScript.&lt;BR /&gt;application. I'm able to generate the token for accessing the service in the JavaScript application only with the PSA (ArcGIS Server) account.&lt;/P&gt;&lt;OL class="lia-list-style-type-upper-alpha"&gt;&lt;LI&gt;I tried with the credentials of portal administrator account for acquiring token for the secured URL, but i 'm not aware of how to access the Secured URL from the token generated from PORTAL&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var tokenvalue = $.ajax({
                type: "POST",
                url: "https://[mydomain]/server/tokens/generateToken",
                data: {
                    username: username,
                    password: password,
                    client: "requestip",
                    expiration: '120',
                    f: "json"
                },
                dataType: "json"
            });
            if (tokenvalue) {
                tokenvalue
                    .success(function (response){
                        if (response.token) {
	          console.log(tokenvalue)
                            IdentityManager.registerToken({
                                server: "https://[mydoamin]/server/rest/services",
                                token: response.token
                            });
                            console.log(response.token);
                            var layerUrl = "https://[mydomain]/server/rest/services/Landuse/MapServer";
                            var layer = new MapImageLayer({
                                url: layerUrl
                            });
                            map.add(layer);
                        }
                    })​&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Is it only possible to acquire token from the federated server only using the PSA or is there any other way to acquire the Token.&lt;/LI&gt;&lt;LI&gt;Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved &amp;amp;&amp;nbsp;point me to some working examples.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;I'm really stuck in this concept and anyone can explain&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 09:05:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/secured-service-access-from-a-federated-arcgis/m-p/1082436#M74010</guid>
      <dc:creator>MANESK</dc:creator>
      <dc:date>2021-07-24T09:05:42Z</dc:date>
    </item>
  </channel>
</rss>

