Moodle is a Free and Open-Source Software (FOSS) learning management system written in PHP. Drupal is also an Open-Source CMS. We require to integrate Moodle and Drupal with a single login system. For that, I have followed the steps mentioned below.
Changes to be done in the Drupal site:
- Install the following modules in the Drupal site.
- In Drupal there should be a user with role 'service-authentication' which is required by the Moodle site Drupal services configuration.
- Create user fields like firstname, lastname,city, country etc because Moodle requires these values. Please note the input for the Country field should be 2 characters.
Changes to be Done in the Moodle Side:
After installing Moodle in the same server,
- Download the plugin 'moodle-drupalservices-master'(Moodle plugin to connect to Drupal services) and rename it to 'drupalservices' and put the folder in auth directory of moodle. ie, moodle -> auth -> drupalservices.
This plugin checks if there is a valid Drupal session cookie and then connects to Drupal services and retrieves Drupal user info.
sudo wget https://github.com/cannod/moodle-drupalservices/archive/master.zip sudo mkdir drupalservices sudo unzip master.zip -d drupalservices/ sudo mv moodle-drupalservices-master/* . sudo mv drupalservices/ moodle/auth/
- Login to Moodle site with admin credentials and then go to Plugins -> Authentication -> Manage Authentication -> Drupalservices. Configure Drupalservices by specifying the Drupal site URL and Drupal fields for user data and enable the service.
- Run cron from Moodle side.
For Testing Single Sign on
- Login to Drupal site.
- Access the Moodle site. You will be forced to enter the basic information for first time users.
- Logout from the Moodle site. You will be automatically logged out from the Drupal site also.