<?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 Token generation from Federated Server and Portal in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/token-generation-from-federated-server-and-portal/m-p/1080733#M73948</link>
    <description>&lt;P&gt;In our organization we use a federated ArcGIS Server with Portal. I'm consuming a secured REST service URL in a JavaScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;This is my code

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;P&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;BR /&gt;I tried to disable the PSA account and then tried with the credentials of portal administrator account for acquiring token for the secured URL, but i got no luck using that.&lt;/P&gt;&lt;P&gt;Is it only possible to acquire token from the federated server only using the PSA or is there any other way.&lt;/P&gt;&lt;P&gt;Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved in it.&lt;/P&gt;&lt;P&gt;Anyone to help !!!!&lt;/P&gt;</description>
    <pubDate>Fri, 23 Jul 2021 12:50:53 GMT</pubDate>
    <dc:creator>MANESK</dc:creator>
    <dc:date>2021-07-23T12:50:53Z</dc:date>
    <item>
      <title>Token generation from Federated Server and Portal</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/token-generation-from-federated-server-and-portal/m-p/1080733#M73948</link>
      <description>&lt;P&gt;In our organization we use a federated ArcGIS Server with Portal. I'm consuming a secured REST service URL in a JavaScript&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;This is my code

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;P&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;BR /&gt;I tried to disable the PSA account and then tried with the credentials of portal administrator account for acquiring token for the secured URL, but i got no luck using that.&lt;/P&gt;&lt;P&gt;Is it only possible to acquire token from the federated server only using the PSA or is there any other way.&lt;/P&gt;&lt;P&gt;Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved in it.&lt;/P&gt;&lt;P&gt;Anyone to help !!!!&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 12:50:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/token-generation-from-federated-server-and-portal/m-p/1080733#M73948</guid>
      <dc:creator>MANESK</dc:creator>
      <dc:date>2021-07-23T12:50:53Z</dc:date>
    </item>
  </channel>
</rss>

