Not able to connect to Content Server REST API using OTDS

Hello,

I am trying to configure Content Server UI Widgets but are not working with OTDS users, getting the error:
"Invalid username/password specified." although the authentication to Content Server UI is working fine with OTDS users.

I tried to connect directly to Content Server REST API auth method from a very simple Javascript code:

var credentials = { userName: "demo", password: "xxxx" };
$.post(urlCS + "/auth", credentials, function (response) {
});

and I get the same error.

Any idea?

Thank you.

Tagged:

Comments

  • Ferdinand Prantl
    Ferdinand Prantl E Community Moderator

    Do you use the login user name, with which the user is visible in the CS user administration?

  • The OTDSticket is needed to authenticate, can be got using OTDS REST API.
    This topic gave me the clue: https://developer.opentext.com/webaccess/#url=/awd/forums/questions/10775891/sso+between+portal+and+cswidget+using+otds&tab=501

    And here is my code:

    csui.onReady(function () {
    
        var urlOTDS = "http://OTDSserver/otdsws/rest/authentication/credentials";
        var urlCS = "http://OTCSserver/OTCS/cs/api/v1";
    
    
    
              // Principal call //
              getValorTicketCS()
              .then(createWidget)
              .fail(function (request) {
                alert(request.status, request.statusText, request.responseJSON);
              });
              ///////////////////
    
    
    
    
              function getValorTicketCS() {
            return jQuery
                .ajax({
                url: urlOTDS,
                method: 'POST',
                data: JSON.stringify({
                    "userName" : "user",
                    "password" : "password"
                }),
                dataType: "json",
                contentType: 'application/json'
                  })
                  .then(function (response) {
                return response.ticket;
                  });
            }
    
            function createWidget(ticket) {
                  new csui.FolderBrowserWidget({
                connection: {
                      url: urlCS,
                      supportPath: "/supportPath",
                      authenticationHeaders: {OTDSTicket: ticket}
                    },
                start: { id: 2000 },
                breadcrumb: {  },
                facetPanel: false,
                placeholder: "#browser"
                }).display();
            }
    
    
        });
    

    // ]]>

  • Ferdinand Prantl
    Ferdinand Prantl E Community Moderator

    Yes, you can authenticate against the CS REST API using the OTDSTicket too. However, the OTDS integration module running on the CS should make it trasparent, so that you do nto need to know the OTDS URL too.