Gigya Job Openings


Skip to end of metadata
Go to start of metadata

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.

Solution Overview

The integration includes both client-side and server-side integration segments. The server-side integration is required for security reasons and implements authentication and token generation.

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).

If you are using an environment/language other than PHP, copy the JavaScript client-side integration segments. The PHP server-side integration segment is simple and can be translated into any other environment or language. Please contact your Gigya Implementation Consultant for assistance.

Gigya's integration with Disqus requires your Disqus account to have Single Sign-On enabled, which is available with a Disqus Pro level subscription.


Running Demo

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:

Or, if you are implementing Gigya's Customer Identity (RaaS) platform, download an integration demo using RaaS:

To run the integration demo:

Edit inc/config.php, insert your site domain, and your Gigya and Disqus API configurations:

// 1. Insert your site domain
define('WEB_ROOT', 'http://' . SITE_DOMAIN . '/disqus/');

// 2. Insert your Gigya API key and Secret key
// See:

// 3. Insert your Disqus API key, Secret key and Shortname
// See:

To integrate in your own project

Assuming you have already implemented Disqus SSO and Gigya, here are the steps to integrate both:

  1. Copy the following files to your project:
    • js/disqus.js - JavaScript integration module
    • 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.
  2. Load the JavaScript integration module on any page with a Disqus thread -- parameters are passed within the script tag:

    <!-- Disqus.js synchronizes Disqus with Gigya -->
    <!-- All disqus_config options are supported: -->
    <script src="js/disqus.js" type="text/javascript">{
      init: true, // Load Disqus SDK -- set to false if SDK will be loaded externally
      short_name: 'disqusshortname',
      token_ajax_url: 'ajax/disqus.js.php', // Included is full example code for this process in PHP
      page: {
        api_key: '12345'
      sso: { // All URLs must be absolute path:
        name: 'Gigya',
        button: '',
        url: '',
        logout: '',
        width: 740,
        height: 430
    See an implementation example in the demo in index.php (see below).

Integration Demo Explanation

The integration demo includes the following files:

Disqus files

The following files are required for the Disqus SSO implementation:

  • login.php
  • logout.php
  • img/login.gif
  • js/jquery.cookie.min.js
  • js/jquery.min.js

Gigya files

Disqus-Gigya Integration Files

The following files are the core of the Disqus-Gigya Integration. Insert these files into your project: 

  • js/disqus.js - JavaScript integration code
  • ajax/disqus.js.phpThe server-side signing code. This file uses lib/GSSDK.php and inc/config.php

Demo Files

  • index.php - the web page. Includes a link that invokes Gigya's Login PluginLoads the JavaScript integration module:

    <!-- Disqus.js synchronizes Disqus with Gigya -->
        <!-- All disqus_config options are supported: -->
        <script src="js/disqus.js" type="text/javascript">{
          init: true, // Load Disqus SDK -- set to false if SDK will be loaded externally
          short_name: '<?php echo DISQUS_SHORTNAME; ?>',
          token_ajax_url: '<?php echo WEB_ROOT; ?>ajax/disqus.js.php',
          page: {
            api_key: '<?php echo DISQUS_API_KEY; ?>'
          sso: {
            name: 'Gigya',
            button: '<?php echo WEB_ROOT; ?>img/login.gif',
            url: '<?php echo WEB_ROOT; ?>login.php',
            logout: '<?php echo WEB_ROOT; ?>logout.php?returnURL=<?php echo urlencode('http://' . SITE_DOMAIN . $_SERVER["REQUEST_URI"]); ?>',
            width: 740,
            height: 430
  • js/index.js - implements a naive Gigya Social Login.
  • inc/config.php - configuration file. Includes both Disqus and Gigya API configurations.