Token generation from Federated Server and Portal

193
0
07-20-2021 02:10 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

 

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

 

application. I'm able to generate the token for accessing the service in the JavaScript application only with the PSA (ArcGIS Server) account.
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.

Is it only possible to acquire token from the federated server only using the PSA or is there any other way.

Also kindly suggest to acquire the token using Portal to access the secured REST URL and the steps involved in it.

Anyone to help !!!!

0 Kudos
0 Replies