Secured Service access from a Federated ArcGIS Server using JS API

150
0
07-24-2021 02:05 AM
MANESK
by
New Contributor III

In our organization we use a federated ArcGIS Server with Portal.
I'm consuming a secured REST service URL in a JavaScript.
application. I'm able to generate the token for accessing the service in the JavaScript application only with the PSA (ArcGIS Server) account.

  1. 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

 

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);
                        }
                    })​

 

  • 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.
  • Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved & point me to some working examples.

I'm really stuck in this concept and anyone can explain

0 Kudos
0 Replies