Status: Open
Status: Answered
Status: Closed
Status: Duplicate

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

0
Posted May 06 by Alban Loxha.

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

4 Answers

1
BEST ANSWER: As chosen by the author.

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?


0
BEST ANSWER: As chosen by the author.

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.


0
BEST ANSWER: As chosen by the author.

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.


0
BEST ANSWER: As chosen by the author.

Thanks for your help Ferdinand.


 You have subscribed and will receive email notifications of updates to this topic. To unsubscribe, uncheck the checkbox.

Statistics

Related categories

Related tags

Your answer

To leave an answer, please sign in.