Problem Authenticating with REST API and SSO
Hi All ,
I am having problem authenticating user using SSO token with REST API. I have made sure that this user has read and modify permission for REST API. I am using PHP SSO client. I keep getting authentication failed error. SSO token works totally fine when I set it in browser cookie but not working with REST API . Is there any different token we need to generate for REST API?
Here is the code snippet I am using.
Require_once("lithium_sso.php");
$sso_key = "xxxxx";
$lithium = new lithium_sso("xxxxx", "xxxx",$sso_key);
$settings_array = array();
$settings_array["roles.grant"] = "Moderator";
$liToken = $lithium->get_auth_token("89", "ismail", "ismail@gmail.com", $settings_array);
$post_data="sso.authentication_token=$liToken";
$process = curl_init($host);
curl_setopt($process, CURLOPT_HTTPHEADER, array('Content-Type: application/xml', $additionalHeaders));
curl_setopt($process, CURLOPT_HEADER, 0);
curl_setopt($process, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($process, CURLOPT_TIMEOUT, 30);
curl_setopt($process, CURLOPT_POST, 1);
curl_setopt($process, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE);
$return = curl_exec($process);
echo $return;
Can someone help ??
Thanks
Ismail