Home → Admin Manual → System Administration → Black Box Authentication (staff login)
Black box authentication allows you to integrate your organizations authentication system with HelpSpot. Configuration requires only a few simple steps.
In the root of your installation there's a folder called /custom_code. Within that folder is the BlackBox-base.php file. This file contains the empty BlackBox function:
function BlackBox($username, $password){
/* DO YOUR AUTHENTICATION HERE */
return false;
}
Customize this function to do authentication against your internal system by using the username and password provided. Here is an example of the function customized to authenticate against a MySQL database: (normal security procedures left out for clarity)
function BlackBox($username, $password){
$dblink = mysql_connect('localhost', 'mysql_user', 'mysql_password');
mysql_select_db('database', $dblink);
$result = mysql_query("SELECT userid
FROM users
WHERE users = '$username' AND pass = '$password'", $dblink);
$num_rows = mysql_num_rows($result);
if($num_rows == 1){
return true;
}else{
return false;
}
}
Returning true will authenticate the user, while false denies access. Note that even after you return true, HelpSpot looks up the username to make sure the username is that of a valid HelpSpot user. If you have not assigned the username to any of your staff then authentication will still fail.
Before enabling check each account account that will be impacted by this authentication changes to make sure they have "black blox username" set. If they do not, they will not be able to login.
Enabling Black Box authentication is a two step process. First you must rename the BlackBox-base.php file to BlackBox.php. Second, you must change the authentication type to Black Box [Admin->Settings]. After changing the setting you will likely have to login again at which point the login box should say "username" instead of "email".
HelpSpot still requires a password for all accounts even though it's not used for your custom authentication. This is because HelpSpot will attempt to login against it's own internal authentication when your custom authentication returns false. This allows users to get into HelpSpot even if the custom function is not working correctly using their HelpSpot email and password.