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.
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);
}
})
I'm really stuck in this concept and anyone can explain