How to pass NTLM Authentication to an AJAX call with REST API

Options

When posting a document to CS with REST API, how can I pass NTLM authentication to REST when making an ajax call for users?

For testing we're using 'admin' username/password to handle the authentication (see example below) and post documents, ideally we would like to use the current user's credentials to handle the authentication call.

Please note not using AppWorks, this is mainly for a html page within content server, nor do we use OTDS instead we use CSDS.

function authenticate() {

$.ajax({
    type: "POST",
    url:  baseApiURL + "/v1/auth",
    data: { username: "Admin", password: "Password" }
}).done(function(data) {
    otcsTicket = data.ticket;
}).fail(function(request, statusText, statusMessage) {
    // ...failed
});

};

Many thanks,
Alban

Tagged:

Comments

  • CS REST API does not provide NTLM Authentication. The portal, where you host your page is supposed to authenticate the user and pass the ticket to the REST API. Will your code run an a CS page (request handler) generated by WebLingo?

  • Thanks for you reply, I've realized the API call was ignoring the username and password, so the NTLM authentication is fine.
    However, some users login with their username and pass in a standard way and I cant authenticate without requesting another username and password.
    Please note this code is within a webreport on CS10 so I would like to use the same credentials.

  • If you have a webreport, which produces HTML output and includes a JavaScript code there, you can generate the OTCSTicket for the CS REST API communication there.

  • Thanks for your help Ferdinand.