Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to obtain OTDS token when using SSO ?

Status
Not open for further replies.

Ruud Bax

Technical User
Jun 6, 2018
3
NL
I would like to get an OTDS token so I can call the integration widgets for the user that's issueing the request.
We have Content Server configured for SSO using OTDS; so how can I get an OTDS ticket for the current user using the REST API ?
 
My cs directory on the frontend is set to Windows Authentication.
 
Then probably the way is to basically try to hit a livelink page like a custom view/appearance this would give you the Livelink Cookie/OTDS Cookie . Livelink's REST API will not accept a cookie by design because of security loop holes,hence it is mandatory to supply a Web Header before calling it.This snippet that I am posting actually is inside an appearance I use it to repaint a menu don't worry about the details but look at the colored invocation that's how a REST API call should be formulated.

So for what its worth look at this snippet

Theoretically in regular livelink if you want to play with REST Code the Livelink webserver has to be anonymous meaning on first login you have to supply a userid/password
May not work in your IWA as I don't have a IWA based system now but at least you should know that the headers is what is important.

Code:
<script>

$(document).ready(function() {
	
	[highlight #FCE94F][COLOR=#CC0000][i][b][COLOR=#EF2929]$.ajax({
		method: "GET",
		url: baseURL + "/api/v1/auth",
		headers: {
			"OTCSTicket": getCookie("LLCookie")
		},[/color][/b][/i][/color][/highlight]
		success: function( data ) {
			var userData = data.data;      //if the REST API is successful look for the JSON Response from the Server using Dev Tools
			var first_name =userData.first_name
			var last_name =userData.last_name
                        alert("Hi Ya you Dawg..."+ first_name+last_name);     

			
		}, error: function(response, textStatus, errorThrown) {
			var message = "[" + response.status + "] " + errorThrown;
			console.error("Error calling auth for user: " + message + "\n" + response.responseText);
		}
	});
});

function getCookie(cname) {
    var name = cname + "=";
    var decodedCookie = decodeURIComponent(document.cookie);
    var ca = decodedCookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

</script>

In essence what you see is I am just using the getCookie to do it and set a alert in that page(OTVar has already things you can look for I am just showing you a successful REST API call:))



Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Thanks for that; that part seems to work.
Now how can I use that token to call the Integration Widget ?

Regards,
Ruud
 
If the Integration Widget takes the form of LLURL/RESTAPICALL then what the above code shows is


baseURL/api/v1/

any command in this command set should work



Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top