You need to sign in to do that
Don't have an account?
jonc.ax191
Implementing single sign on for self service portal
I'm new to using the Sforce API and I was wondering if someone knows of an example of implementing single sign-on for the self service portal. For my scenario, a user logs into our software, navigates to the portal page on our site which automatically logs them in to the self-service portal, and then the portal is displayed in an Iframe on our site.
I suppose I can do a HTTP form post to "https://ssl.salesforce.com/sserv/login.jsp" to login the self-service user but can this be done through the API instead?
I use C#
Thanks,
Jon
I suppose I can do a HTTP form post to "https://ssl.salesforce.com/sserv/login.jsp" to login the self-service user but can this be done through the API instead?
I use C#
Thanks,
Jon
Can you share how you hid the logout tab behind a div? I assume you mean the one served by salesforce on the CSS portal pages?
Thanks,
--Kevin
I am trying to use single sign on for our users to access self service after they login to our website. I was instructed to use the API and a SetPassword call. Do you have example code for this? Any help would be greatly appreciated.
-Ryan Moeller
(858) 726-1047
I am trying to use single sign on for our users to access self service after they login to our website. I was instructed to use the API and a SetPassword call. Do you have example code for this? Any help would be greatly appreciated.
-Ryan Moeller
(858) 726-1047
What I did to implement this was to do a post to the actual Self-Service Portal logon screen (the one's users would see), capture the reponse, yank out the redirection URL from the response, and immediately redirect the user with the URL. I use C#.
Here's an example (I didn't try to compile this). This method logs the user in and returns the redirection URL.
private string LoginToSalesforce()
{
string myOrgID = "1234567XXXX"; //Your company's ID
string myUsername = "janedone"; //The self-service user
string myPass = "boo";
string loginDataToPost = "orgId=" + myOrgID + "&un=" + myUsername + "&pw=" + myPass;
//encode data and convert to byte array to send
UTF8Encoding encoding = new UTF8Encoding();
byte[] byteArray = encoding.GetBytes(loginDataToPost);
//Create HttpWebRequest
HttpWebRequest reqSF = (HttpWebRequest) WebRequest.Create("https://ssl.salesforce.com/sserv/login.jsp");
reqSF.Method = "POST";
reqSF.ContentType = "application/x-www-form-urlencoded";
reqSF.ContentLength = loginDataToPost.Length;
//Post the data stream to Salesforce
Stream requestStream = reqSF.GetRequestStream();
requestStream.Write(byteArray, 0, byteArray.Length);
requestStream.Close();
//Get the response data stream from Salesforce
HttpWebResponse respSF = (HttpWebResponse) reqSF.GetResponse();
Stream responseStream = respSF.GetResponseStream();
StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8);
string respHTML = readStream.ReadToEnd();
//Extract URL from other response data. Doing a string search is not the most elegant solution.
//First make sure login was successful
if (respHTML.IndexOf("Invalid username or password.") {
//The URL line we're looking for comes back in the datastream as
//"URL=/sserv/frontdoor.jsp?csssid=xxxxxxxxxxxxxxx&je=0" quotes included
int posBeginURL = respHTML.IndexOf("URL=") + 4; //offset to remove URL=
int posEndURL = respHTML.IndexOf("\"", posBeginURL); //position of the last double quote showing the end of the URL
int lengthURL = posEndURL - posBeginURL;
return "https://ssl.salesforce.com" + respHTML.Substring(posBeginURL, lengthURL); //the full redirection URL
}
else //Login failed
{
return "http://www.mysite.com/myprettyerrorpage.htm";
}
1) Go to you self-service portal settings
2) Edit the "Page Header" (make sure it is displayed in your site)
3) Click the "Show Header" box and "Show HTML" box on the edit page
4) Here's my code for the edit box. If you've changed your font sizes, color scheme, etc, you'll need to change this as appropriate to get the colors to match and to position the div perfectly.
5) Click save and you're done. Die logout button die!
>DIV style="LEFT: 386px; POSITION: relative; TOP: 46px" z-index="1"<
>IMG height=35 src="https://ssl.salesforce.com/sserv/img/tabBg_gray.gif" width=62<
>/DIV<