Topic-icon Facebook Login Not Working

Active Subscriptions:

None
5 years 9 months ago #64230 by Clarenceljw
Hi Guys & Girls,

My JFBConnect Social Login is not working properly, both Twitter & Facebook Login do not work. Attached is a photo of the error. Please advise how to resolve this.

URL: www.clarenceling.com
File Attachment:
The topic has been locked.
Support Specialist
5 years 9 months ago #64235 by mel
Replied by mel on topic Facebook Login Not Working
For Facebook:
That error looks like the redirect URIs are set incorrectly in your application. Please follow the instructions in our FB application setup guide . Specifically, pay attention to Step 21 for "Valid OAuth redirect URIs"

For Twitter:
That error has started cropping up recently as Twitter made a change to their app settings in mid June. Please double-check your Twitter's app setting for "Callback URL". The URL should be your website followed by index.php, like:
https://yoursite.com/index.php
The Twitter setup guide was updated to include the index.php portion recently, which you may have missed.

-Melissa
The topic has been locked.
Active Subscriptions:

None
5 years 9 months ago #64239 by Clarenceljw
Hi Mel,

I have implemented Step 21, but it still doesn't work. What should I do now?

Thanks.
The topic has been locked.
Support Specialist
5 years 9 months ago #64241 by alzander
Replied by alzander on topic Facebook Login Not Working
Melissa pulled me in to give things a separate pair of eyes. There is another issue that we've found that definitely is causing some problems. In your JCH Optimized Javascript file, there's another plugin or component loading the Facebook Javascript library. That inclusion is hijacking the login request, which is why things are working right.

Unfortunately, there's not much to go off of as to what is including the script. This is the offending Javascript though, which is right underneath the JFBConnect inclusion of the Facebook library:
try{(function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(d.getElementById(id))return;js=d.createElement(s);js.id=id;js.src='https://connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.12&appId=1651259101774010&autoLogAppEvents=1';fjs.parentNode.insertBefore(js,fjs);}(document,'script','facebook-jssdk'));}catch(e){console.error('Error in script declaration; Error:'+e.message);};
I'd recommend disabling JCH Optimize (temporarily), which may help understand what other extension is adding that code. You'll need to disable the other extension's inclusion of the Facebook library though.

The other alternative, which may get things going immediately, is to switch the JFBConnect -> Configuration -> Facebook setting of "Show 'Login Credentials' in popup" to "No". That will redirect the user to Facebook instead of using the popup. However, even with that setting, the duplicate inclusion of the Facebook library may still cause other issues down the line, so we'd still recommend investigating that further.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
5 years 9 months ago #64249 by Clarenceljw
Hi Alex,

I think I found the offending code and deleted it. Please advise if I am incorrect. However, since it still doesn't work, please go through my website to find out what's wrong. JCH Optimize is disabled. Thank you.
The topic has been locked.
Support Specialist
5 years 9 months ago #64253 by alzander
Replied by alzander on topic Facebook Login Not Working
Thanks for disabling JCH Optimize. That helps see things much clearer. The offending code is still there, but it's more obvious where it's coming from. Here's the code:
<div id="custom-3018-particle" class="g-content g-particle"> <script>
 var chatDiv = document.createElement('div');
 chatDiv.className = 'fb-customerchat';
 chatDiv.setAttribute('page_id', '1069836513045464');
 chatDiv.setAttribute('ref', '913ed8d2fb069f5635efc8b3a8eb379d39bfd4f7635b694716');
 document.body.appendChild(chatDiv);

 window.fbAsyncInit = function() {
   FB.init({
     appId            : '2015199145383303',
     autoLogAppEvents : true,
     xfbml            : true,
     version          : 'v2.12'
   });
 };

 (function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "https://connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));
</script>
The last part starting with (function(d, s, id) is what needs to be removed. The remaining code that extension installs (fb_customerchat?) is fine.

I hope that helps,
Alex
The topic has been locked.
Active Subscriptions:

None
5 years 9 months ago #64254 by Clarenceljw
Resolved! Thank you both!
The topic has been locked.
Support Specialist
5 years 9 months ago #64257 by alzander
Replied by alzander on topic Facebook Login Not Working
Glad to hear you got it going. If you need anything else, just let us know!

Thanks,
Alex
The topic has been locked.