Gigya's integration with Disqus makes it easy to integrate Gigya's customer identity management solution and apply social data to your existing Disqus on-site application.
The flow in a nutshell - when a user logs into Gigya via social network or site login, a request is issued to the Gigya server. The server-side integration segment receives Gigya's response, and uses Gigya user data along with the Disqus secret key to create a Disqus token. The token is returned to the client-side and stored within the Disqus cookie, and then the Disqus UI is refreshed without page reload. The user is now logged into Disqus & Gigya. If the user was previously logged into Disqus directly or through other means, this is overridden. When the user logs out of Gigya or Disqus, the session is no longer valid (detected automatically), the Disqus cookie is deleted and the UI is refreshed on the client-side.
This Integration module includes an integration demo in PHP. You may download the source code below. To implement the integration, copy the integration segments from the demo to your own project (please find instructions below).
Gigya's integration with Disqus requires your Disqus account to have Single Sign-On enabled, which is available with a Disqus Pro level subscription.
The following running demo shows a Gigya-Disqus integration. The Gigya part is implemented using a basic Social Login implementation. Clicking on the "Login" link in the upper-left hand corner of the page invokes Gigya's Login Plugin.
After login, you may add comments in Disqus using your Social Identity powered by Gigya.
To view this demo in a popup, click here.
The code of this demo is available for download (see below).
Download the source code
The integration demo source: disqus-integration-demo.zip
To run the integration demo:
Edit inc/config.php, insert your site domain, and your Gigya and Disqus API configurations:
To integrate in your own project
Assuming you have already implemented Disqus SSO and Gigya, here are the steps to integrate both:
- Copy the following files to your project:
- ajax/disqus.js.php - The server-side signing code. This file uses lib/GSSDK.php (Gigya's PHP SDK) and inc/config.php (configuration file, that includes both Disqus and Gigya API configurations). Edit disqus.js.php so that it points to the correct location of these files in your project.
Integration Demo Explanation
The integration demo includes the following files:
The following files are required for the Disqus SSO implementation:
- lib/GSSDK.php - Gigya's PHP SDK
Disqus-Gigya Integration Files
The following files are the core of the Disqus-Gigya Integration. Insert these files into your project:
- ajax/disqus.js.php - The server-side signing code. This file uses lib/GSSDK.php and inc/config.php
- js/index.js - implements a naive Gigya Social Login.
- inc/config.php - configuration file. Includes both Disqus and Gigya API configurations.