We have installed the Ubuntu Dreamfactory 2.0 VM and succesfully connected it to an MSSQL Server. We then created a simple login page (index.html) that does an API call to log in a user that exists on our Dreamfactory instance. This login returns a session ID to be used in subsequent API calls. Next, we want to rather authenticate users using an LDAP connection to Active Directory.
We created a new service called "AD_service" and added the LDAP server and Base DN values. Then on the API DOCS page in Dreamfactory, in the POST /user/session we add in the body the following json string:
When we execute it, it returns "invalid user name and password provided" (code 401). The same happens when we try to execute it from PHP using curl as follows:
$data = array("username" => "AD_Username", "password" => "AD_Password");
$data_string = json_encode($data);
$ch = curl_init('http://xxx.xxx.xxx.xxx:port/api/v2/user/session?service=AD_Service');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
$result = curl_exec($ch);
We have, however, been able to make a curl connection to Active Directory in Ubuntu and Mac's terminal using the credentials as above. Also, the LDAP server and Base DN values were verified using JXplorer.
We also installed the php5-ldap package (ldap.so) and added it to the php.ini file, but alas, still getting the "invalid user name and password provided" message.
Any ideas what could be the cause?