AnsweredAssumed Answered

How can I use Drupal to log in to Sugar?

Question asked by guilhem guilhem on Jun 19, 2014
Hi, i want my costumer to be abble to login on drupal  via sugar accounts, using rest api im abble to login via an external server , but i don't know how to make the link between drupal and sugar.
This Works i get an answer from Sugar
  array(
       'user_name' => 'admin',
       'password' => md5('password'),
  ),
);
$json = json_encode($parameters);

$postArgs = 'method=login&input_type=JSON&response_type=JSON&rest_data=' . $json;
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
// Make the REST call, returning the result
$response = curl_exec( $curl );

// Close the connection
curl_close( $curl ); 
// Convert the result from JSON format to a PHP array
$result = json_decode( $response );

// Echo out the session id
var_dump($result);
echo $result->id;

?>

Outcomes