Finally i found the solution for this question. And Step by step for anybody need that:
- First, you need contact to Disqus’s support team to enable SSO on your account by this form https://disqus.com/support/?article=contact_SSO.
- After SSO enable, you need to set up your SSO domain at https://disqus.com/api/sso/ and https://disqus.com/api/applications/ (You can read document in https://help.disqus.com/customer/portal/articles/236206-integrating-single-sign-on)
- Paste this code in your theme
<?php
define('DISQUS_SECRET_KEY', '<insert secret key here>');
define('DISQUS_PUBLIC_KEY', '<insert public key here>');
$user = wp_get_current_user();
$data = array(
"id" => $user->data->ID,
"username" => $user->data->user_login,
"email" => $user->data->user_email
);
function sb_dsq_hmacsha1($data, $key) {
$blocksize=64;
$hashfunc='sha1';
if (strlen($key)>$blocksize)
$key=pack('H*', $hashfunc($key));
$key=str_pad($key,$blocksize,chr(0x00));
$ipad=str_repeat(chr(0x36),$blocksize);
$opad=str_repeat(chr(0x5c),$blocksize);
$hmac = pack(
'H*',$hashfunc(
($key^$opad).pack(
'H*',$hashfunc(
($key^$ipad).$data
)
)
)
);
return bin2hex($hmac);
}
$message = base64_encode(json_encode($data));
$timestamp = time();
?>
<script>/**
* RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
* LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
*/
var disqus_config = function () {
this.page.url = '<?php the_permalink(); ?>';
this.page.identifier = '<?php echo get_the_ID();?>';
this.page.title = '<?php echo get_the_title(); ?>';
this.page.remote_auth_s3 = "<?php echo sprintf('%s %s %s', $message, sb_dsq_hmacsha1($message . ' ' . $timestamp, DISQUS_SECRET_KEY), $timestamp) ?>";
this.page.api_key = "<?php echo DISQUS_PUBLIC_KEY; ?>";
};
(function () {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = '//{insert your forum here}.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
Expand snippet
Run your site and see disqus config render: enter image description here Copy remote_auth_s3 and paste into https://disqus.com/api/sso/ to check the result.
Done.