The Single Sign-On Method was created to provide a redirect URL for which a user can then navigate from without having to provide their credentials a second time.
To create a Single Sign-On, you will need to authenticate by UserKey or UserToken. (see: Authentication Methods).
While there are no required parameters for the /SSO method, there are two query string parameters you may want to concern yourself with.
https://api2.redtailtechnology.com/crm/v1/rest /sso?ep={ENDPOINT}&id={ENTITYID}
The query string ?ep, as you would assume, is where we specify our endpoint. If we do not specify the endpoint, which may be fine for the purpose at hand, the user will be redirected to the dashboard by default.
There are currently 5 mapped endpoints.
End Points | Page |
calendar
|
User's Calendar
|
contactaccounts
|
Client's Account Page |
contactoverview | Client Record Overview Page |
contacts | Contacts A-Z page |
reports | Standard Reports Page |
dashboard(default) | Dashboard Landing page |
If we would like to have the user be redirected to their Calendar, for instance, we would add the query string parameter ?ep=calendar
However, for the contactaccounts and contactoverview endpoints we will need to specify the entityid.
For the methods currently available, the entityid IS the contactId for a given record.
?ep=contactoverview&?id=384843
?ep=contactaccounts&?id=384843
The URI
https://api2.redtailtechnology.com/crm/v1/rest /sso?ep=contactoverview&?id=384843
would provide the information required to return the SSO Redirect URL for the contact overview's page of contact record 384843, which is equivalent to
https://smf.crm.redtailtechnology.com/crm/record/default.aspx?clid=384843
Below is a sample request in C# using our URI, sample credentials, and the method type. The content type "text/json" work equally well.
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("https://api2.redtailtechnology.com/crm/v1/rest/sso"); req.Headers[System.Net.HttpRequestHeader.Authorization] = "Userkeyauth " + Convert.ToBase64String(System.Text.Encoding.Default.GetBytes("6C135EDF-C37C-4039-AEF3-5DFC079F9E6A:B7B4BCDD-67C8-449C-B1D4-C1AAFE49703D")); req.Method = "GET"; req.ContentType = "text/xml";
//and here's the response stream.
HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(resp.GetResponseStream());
The corresponding response will be similar to the following.
Sample Response(JSON) |
{"APIKey":"6C135EDF-C37C-4039-AEF3-5DFC079F9E6A",
"CID":5999,
"DatabaseID":99999,
"Message":null,
"Name":"Les Andrews",
"ReturnURL":"https:\/\/accounts.redtailtechnology.com\/login.aspx?p=c&token=5hY8WjpKOKxdzLJ7a%2fHKiSDFJHGkjhsdfoklG2UvEbAwES4eevqUnCWUnf4ke2jPTYbp5yFnfmDZd8xV1cFFhqNjzHPU7lLOLIC4UlT%2fiHQN091Y1tcp3Ndkf4ke5ygRfM&ep=calendar&i=0",
"Status":1,
"UserID":41974,
"UserKey":"B7B4BCDD-67C8-449C-B1D4-C1AAFE49703D"}
|
Comments