+ Start a Discussion
sanjaykumarsanjaykumar 

single sign on

Hi All, 
                 
Actually i am trying to  implement  single sign  for a application where the user will log on to salesforce and when he clicks the client application tab , he would be able to log into the other web application without needing to pass the user id and password ..
 
Can u tell me what all steps need to be done to perform it .
 
Thanks in Advance,
sanjay
ClaiborneClaiborne

Code:

require_once ('soapclient/SforcePartnerClient.php');
require_once ('soapclient/SforceHeaderOptions.php');

$wsdl = 'partner.wsdl.xml';
$errors = null;

session_start();

   // Check if coming from SFDC
if (!isset($_SESSION['sessionId'])) {
if (isset($_GET['sessionId']) AND isset($_GET['location'])) {
    session_destroy();
    session_start();
    $_SESSION['sessionId'] = $_GET['sessionId'];
    $_SESSION['location'] = $_GET['location']);
    $_SESSION['wsdl'] = $wsdl;
}       
else {
      // link did not come from salesforce.com
    header("Location: unauthorized.php—reason=sfdc");
    exit;            
}
}
  // Create connection to salesforce.com
$myClient = new SforcePartnerClient();
$client->createConnection($wsdl);

$myClient->sessionId = $_SESSION['sessionId'];
$myClient->setSessionHeader($myClient->sessionId);
$myClient->setEndpoint($_SESSION['location']);


 
First, the site hosting your external link should be supporting https.

Second, download the partner wsdl file and place it on your web site.

Next, the link for your web tab needs to include the sessionId and location. It will look something like this:

https://www.yourpage.com/sfdcpage.php?sessionId={!API_Session_ID}&location={!API_Partner_Server_URL_70}

The above example is for php.

On the web page, you need to re-establish the session using the sessionId and location. The specifics for this depend on the language.

The code above uses the sforce php tool kit and php 5.1.4.

 

 

suresh_psuresh_p
Hi Sanjay, Browsing thorough the community, found this post which is relavant to my question. I am also having same requirement....where in user logs into salesforce, and when he clicks on some tab he needs to login to another application automatically either using same salesforce credentials or by fetching username & password from a custom object in salesforce. Can you please let me know how to implement this and what we need from salesforce end and the other application end. Also there is another requirement where in we need to maintain the session for the other web application as long as salesforce session is active. Any inputs are appreciated. Thanks