Articles in this section
Category / Section

How to Sign-in/Register Users from your Website Using HTTP Single Sign-On (SSO)

2 mins read

Enable your website users to register or log in once and effortlessly navigate across BrainCert's Enterprise LMS without needing to log in again. Single sign-on creates a better user experience and reduces the need to create users manually in the LMS.

Single sign-on (SSO) is a session and user authentication service that permits a user to use one set of login credentials (e.g., username and password) to access multiple applications. The service authenticates the end user for all the applications the user has been given rights to and eliminates further prompts when the user switches applications during the same session.

What are the requirements?

The feature integrates easily with your website with a few lines of code, making it quick and straightforward to set up Single Sign-On (SSO) for your entire website users. No need for complex identity provider setup or Security Assertion Markup Language 2.0 (SAML 2.0) integration.

How does it work?
Copy the attached SSO code and use the example PHP code in your website to register new users and allow the SSO of existing users without typing their username and password in the LMS login screen. Identity mapping is based on the email address which must be the same in both origin (your website) and target (Enterprise LMS).

How do I use it on my website?

To enable HTTP SSO in your Enterprise LMS, click on "Extensions" under 'Global Settings'.


Enable HTTP SSO extension, and save your API and Auth keys. A new user account will be created in the LMS when your website users click on the SSO hyperlink for the very first time.


Copy the following PHP library and use it on your website where you would like the users to launch the LMS link. You can also set Group IDs separated by a comma to easily add users to LMS groups.

$lmsurl ='YOUR_LMS_URL'; # Your LMS Domain url. For example, $email = "[email protected]"; # Email address of the user $username = "YOUR_USERNAME"; # Username $first_name = "YOUR_FIRSTNAME"; # First name of the user $last_name = "YOUR_LASTNAME"; # Last name of the user $group_id = "YOUR_LMS_GROUP_IDS"; # LMS group IDs separated by a comma $data = array();$data['sso_api_key'] = "YOUR_API_KEY"; # API KEY $data['sso_auth_key']= "YOUR_AUTH_KEY"; # AUTH KEY $data['username'] = $username; $data['email'] = $email; $data_string = json_encode($data); $lmsurl = trim($lmsurl,"/"); $ch = curl_init();curl_setopt($ch, CURLOPT_URL, $lmsurl."/sso");curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));curl_setopt($ch, CURLOPT_POST, 1);curl_setopt($ch, CURLOPT_POSTFIELDS,$data_string);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result_json = curl_exec($ch);$result = json_decode($result_json, TRUE); if($result['status']=='ok'){ $token = $result['token'] ; echo $ssourl = "<a href='".$lmsurl."/?token=".$result['token']."&email=".$email."&username=".$username."&first_name=".$first_name."&last_name=".$last_name."&group_id=".$group_id."'>".$email."</a>" ; } else if($result['status']=='error'){ echo $result['message'] ;}

Put the above code on a page and populate relevant parameters such as email addresses using DB queries specific to your website. The hyperlink may look like this when you mouse over:

<a href='[email protected]&username=JohnW&first_name=John&last_name=Wick&group_id=1,2,3'>

Where do I find Group ID?

You can find the ID of the group under "People" --> "Groups".

How to mail account details to new users?
Remember to enable an account notification email, so the new account details including the generated password will be emailed to the user after registration automatically.
Navigate to 'User Registration' under 'Global Settings'. Click on 'Notifications' and open 'User Notifications'. 

Benefit from HTTP SSO to suit your specific requirements.

Was this article useful?
Help us improve this page
Please provide feedback or comments
Access denied
Access denied