I'm trying to run this piece of code in an ASPX page -

var username = ""*******";
var password = ""*******";
var vault = "*******";
var getToken = function (username , password , vault) {
// Request an encrypted token with the login information.
$.ajax ({
url: "http :// example.org/REST/server/ authenticationtokens .aspx",
type: "POST",
dataType: "json",
contentType : "application /json",
data: JSON.stringify ({ Username: username , Password: password ,
VaultGuid: vault }),
success: processToken
});
};

var processToken = function (token) {
// Set the header.
$.ajaxSetup ({ headers: { "X- Authentication " : token.Value } });
};

But when I check the value of processToken I always get this

function (token) {// Set the header.$.ajaxSetup({ headers: { "X- Authentication ": token.Value} }); };

Why is it not implementing? I know I have the URL and credentials correct.

Related posts

Recent Viewed