How do I sign in to WebAPI using SSO? (Examples)
There are bits and pieces scattered about these articles on how to authenticate in the WebAPI using SSO. But there are no examples. The following article is the closest I have come to finding anything that shows how to use the API, but it does NOT use SSO authentication. What I would like is for somebody to help me modify the code given in this example provided by Team Dynamix so that the example allows for SSO authentication, not user/password authentication.
https://solutions.teamdynamix.com/TDClient/1965/Portal/KB/ArticleDet?ID=7693
Particularly, the Http request is made on line 50.
HttpResponseMessage oHttpResponseMsgX = await oHttpClientX.PostAsJsonAsync("auth", new { username = sUsername, password = sPassword });
I've tried changing the method from PostAsJsonAsync to GetFromJsonAsync and removing the username and password part. That didn't work.
Answer (1)
Hi Randy,
You will need to use a TDX User account with a local username/password, a service account, or an admin service account to authenticate to the TDX API. The API does not support SSO authentication for client scripts or applications. There is an API endpoint for "/auth/loginsso", but this is only used internally for certain javascript components of the TDX web application in the context of a browser session, and CORS is disabled for that endpoint so you aren't able to use it in a client-side script.
For more info, take a look at this KB: TeamDynamix API/Web Services Overview
You may also find the API docs for the available auth endpoints helpful as well, accessible at: https://[yourTDXdomain]/TDWebApi/Home/section/Auth (e.g. "https://helpdesk.university.edu/TDWebApi/Home/section/Auth" or "https://example.teamdynamix.com/TDWebApi/Home/section/Auth")
Let me know if that helps,
- Jackson