Problem trying to get the web server auth running

3 years 11 months ago #94925 by jowen
I have recently been using your product and think it is great. I am not new to PHP however have been really struggling to get the web server authentication to work. I have read the docs and while this subject is spoken about I just need some help to get it running.

I am authenticating all users via a MYSQL database login form and not via HTTP. I planned to use cURL to call lime survey. My code I have been using is below and it simply is not working. I think the issue I am having is passing the authenticated user.

Am I completely off the mark for this integration or is there something very minor I am missing?
The build I am using is the latest stable release 200 build number 130406

Thanks in advance
$cred = "user";
$data = array();
$data[] = "Authorization: Basic ". base64_encode($cred);
$ch = curl_init(); 
$timeout = 30;
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HTTPHEADER, $data); 
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_UNRESTRICTED_AUTH, 1);  
$output = curl_exec($ch);
if ($output === FALSE) {  
echo "cURL Error: " . curl_error($ch);    
echo $output;

Please Log in to join the conversation.

3 years 11 months ago #94927 by mdekker
You don't need to do php coding if you use webserver authentication: the webserver handles that for you when configured right. Google on "apache auth mysql" to get some info on how to set this up.

If you want to authenticate in limesurvey via a different mysql database then the one limesurvey uses, you should wait for 2.05 (which is beta now) and write a different authentication plugin.

Menno Dekker

Please Log in to join the conversation.