Turnkey Plugins \ Social Login for Drupal 9 Fork on Github

1. Installation

The installation is not very complicated and should only take a couple of minutes. Please read our instructions carefully and do not skip any steps.

a. Download the extension

Click on the button below to download the extension:

Download Social Login for Drupal 9

b. Enable the Update Manager

Login to your Drupal administration area and open the Manage \ Extend panel. Search for Update Manager and make sure that the module is installed and enabled.

Drupal 9 - Update Manager

c. Install the extension

First navigate to Manage \ Reports \ Available updates and click on + Install new module or theme.

Drupal 9- Install Module

Then click on Browse, select the previously downloaded file and click on Install

Drupal 9 - Upload Module

d. Enable the extension

Navigate to Manage \ Extend, search for OneAll, tick the OneAll Social Login checkbox and then click on Install.

Drupal 9 - Install Social Login

2. Configuration

a. Open the configuration panel

Login to your Drupal administration area and navigate to Configuration \ OneAll Social Login.

Drupal 9 - Setup Social Login

b. Setup the API connection handler

Click on the Autodetect communications settings button. A green success message will be displayed if your server is able to communicate with the OneAll API. Your firewall must allow outbound requests (from your server to the OneAll API server) on either port 80 or 443.

Drupal 9 - Upload Module

c. Enter your API credentials

To obtain your API credentials, please login to your OneAll account and open the page Site Settings \ API Settings & Credentials of a Site. Fill out the API credentials in the Drupal administration area and click on the Verify API Settings button. A green success message will be displayed if your credentials are correct.

Drupal 9 - Upload Module

d. Setup the social networks

Select the social networks that you would like to use by ticking the corresponding checkboxes in your Drupal administration area.

Please note that many social networks require that the webmasters register their website before being able to use their services. To be able to use the plugin, you must therefore register your website. This process is straightforward and takes only a couple of minutes.

It has to be done only once for each provider and we will guide you through this process. To setup your providers, please login to your OneAll account, select a Site and click on Social Networks.

3. Extension Events

Social Login dispatches the following events that can per example be used to store additional social network profile data in your own database. To implement your custom processing, we recommend that you first install our Social Login Event Subscriber Example and then adapt that extension to your needs.

a. SocialLoginUserCreatedEvent

This event is triggered whenever a new user registers using a social network account. Social Login will first create the user account in your Drupal database and then trigger an event that includes the created account as well as the used social network profile data.

        // Dispatches SocialLoginUserCreatedEvent event.
        $event = new SocialLoginUserCreatedEvent ($user, $data);
        $event_dispatcher = \Drupal::service('event_dispatcher');
        $event_dispatcher->dispatch(SocialLoginUserCreatedEvent::EVENT_NAME, $event);
    

b. SocialLoginUserLinkedEvent

This event is triggered whenever an existing users links a social network account to his Drupal account. Social Login will first link the social network account to the user account in your Drupal database and then trigger an event that includes the used account as well as the social network profile data.

        // Dispatches SocialLoginUserLinkedEvent event.
        $event = new SocialLoginUserLinkedEvent ($user, $data);
        $event_dispatcher = \Drupal::service('event_dispatcher');
        $event_dispatcher->dispatch(SocialLoginUserLinkedEvent::EVENT_NAME, $event);
    

c. SocialLoginUserLoginEvent

This event is triggered whenever an existing users logs in using a social network account. Social Login will log the user in and then trigger an event that includes the used account as well as the social network profile data.

        // Dispatches SocialLoginUserLoginEvent event.
        $event = new SocialLoginUserLoginEvent ($user, $data);
        $event_dispatcher = \Drupal::service('event_dispatcher');
        $event_dispatcher->dispatch(SocialLoginUserLoginEvent::EVENT_NAME, $event);
    

4. Troubleshooting

a. The API communication does not seem to work correctly

Please make sure that your firewall does not block outbound requests on both ports 80 and 443. One of these ports must allow outgoing requests (from your server to ours) so that the plugin can establish a communication with our API.

If you have access to the console of your server you can test if outbound requests are allowed by using this command: telnet ping.api.oneall.com 443. If the port is open then you should obtain a result like this:

		~$ telnet ping.api.oneall.com 443
		Trying 136.243.63.184...
		Connected to ping.api.oneall.com.
		Escape character is '^]'.
	

b. You are not authorized to access this page

If you encounter this error after logging in with Social Login, then you might have installed a Drupal module (e.g. Security Kit) which blocks offsite POST requests from our API to your server. To fix the issue please whitelist the following domain for offsite requests:

		*.api.oneall.com
	

c. "Please enable at least one social network in the social login settings." is displayed

If you encounter this message after have enabled social networks in the social login settings, then you might flush your cache installed going to Configuration / Performance / Clear all caches in your Drupal Admin Panel.

5. Fork on Github

Feel free to fork our Drupal GitHub repository to contribute to the development of this module.

User Contributed Notes