Topic-icon Facebook not allowing subdomain login approval

Active Subscriptions:

None
10 years 5 months ago #56063 by haibar
I used to have this working and I do have it working for all other social logins.

I have a site that makes use of GTranslate and all subdomains refer to foreign languages. For example, my main English site is at drinkedin.net and Spanish would be at es.drinkedin.net

I have a wildcard SSL certificate, so that's all covered.

GTranslate handles the subdomains and translates the content on the fly via reverse proxies.

What I do is the following. For example, in \components\com_jfbconnect\libraries\provider\facebook.php, I edit the following:

// Check that additional scope for a user exists. If not, reroute them through Facebook login to obtain it
public function fetchNewScope($newScope)
{
$params = array();
$params = implode(',', $newScope);
if(isset($_SERVER))
$returnBase = "http://" . $_SERVER . ".drinkedin.net/";
else
$returnBase = "drinkedin.net/";
$params = $returnBase . 'index.php?option=com_jfbconnect&task=authenticate.callback&provider=facebook';
$redirect = $this->client->getLoginUrl($params);
JFactory::getApplication()->redirect($redirect);
}

Notice how the redirect_uri preserves the subdomain. In the facebook.php file, I patch this in 3 places. In twitter.php and oauth2.php, I patch it each in one place.

All non-Facebook social logins (using either Twitter or Oauth2) work just fine. In the case with Facebook, I get the error message "We were unable to get information Facebook account. Please try again." for all foreign language subdomains (although English works just fine).

Regarding FB app permissions, I've added all subdomains to the "App Domains" portion of the FB App Settings.

Why won't this work?

Suggestions?
The topic has been locked.
Support Specialist
10 years 5 months ago #56076 by alzander
My guess is that it relates to a requirement that Facebook recently implemented. Please double-check our Facebook Application Setup guide . Specifically, step 15 for setting up valid OAuth redirection URLs. You'll need to make sure that every possible combination of subdomain and http/https is included in that setting.

That's my best guess, but if that doesn't help, can you let us know what is, or isn't, happening? If you set the "Enable Debug Mode" in JFBConnect to 'Yes', is there an error message or any other details you can provide?

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago #56089 by haibar
Setting Debug On (I tried both Logging and On) did nothing. Not sure why not.

I did step #15 of the instructions now. I didn't do it before for main domain (i.e. drinkedin.net) - and everything works fine there. Now I've added all potential subdomains and also SSL versions. I saved the updated FB app. Does it take time for the settings to propagate? It didn't help as I still get the "We were unable to get information Facebook account. Please try again." error message.

What else would you suggest?
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago - 10 years 5 months ago #56162 by haibar
I've found something weird in that it does allow login via foreign language domain on seemingly random occasions (much less than half the time, but if I sometimes retry - it works). Could that behavior tell you something about this problem?

Additionally - if I set the following FB settings, it seems to work much more consistently (almost all the time):

Auto Login - OFF

Show Login Credentials in Popup - ON

Show Logging In Message - ON

Log Out of Joomla Only - ON

I'm not sure I really want the 2nd and 3rd options, but it seems to work then. What is loaded/checked/etc that is different if I set it differently?
Last edit: 10 years 5 months ago by haibar.
The topic has been locked.
Support Specialist
10 years 5 months ago #56182 by alzander
Sorry for missing your earlier post. Updates are generally immediate, though I don't think that matters now.

I just tried on the es. site and was able to login 3 times in a row. Doesn't mean it always works, but that was good. I didn't test before though, so not sure if standard logins would have failed then.

As for the settings you mention, the only one that really affects the login process would be the "Show Login Credentials in Popup". The others use some Javascript to popup messages and whatnot, but don't really interact with Facebook itself.. so I'd focus on that setting for testing on/off. I just tested turning that off (I can do it in the Javascript console in the browser on a per-page basis) and was redirected back to the es. site without being logged in. I didn't see any error message though. It seems like the authentication URL in JFBConnect was automatically redirected to the home page with a 303 redirect. The URL attempted to be hit was:
http://es.drinkedin.net/index.php?option=com_jfbconnect&task=authenticate.login&provider=facebook&return=Lw==&37761a95df6ea3782392312cdd86d0cf=1
I would double check that there's nothing in your .htacess or proxy that would try to redirect that URL somewhere else without letting JFBConnect actually process it first. When the popup option is disabled, authentication happens very differently.

In the latest release, there really weren't any changes in the authentication process for Facebook, so I don't know what would have changed. If you narrow things down, definitely let us know. I hope the above helps a little.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago #56184 by haibar
It works now 100% (seems like all the time) of the time when "Show Login Credentials in Popup" is Enabled.

My problem is if it's not enabled. As you said, the login is very different.

You wrote:

alzander wrote: es.drinkedin.net/index.php?option=com_jf...782392312cdd86d0cf=1


and I notice that this has more parameters than what I setup in the FB app's return URI settings. The extra part

alzander wrote: &return=Lw==&37761a95df6ea3782392312cdd86d0cf=1

is not familiar - is that a token? Is that going to mess up FB's acceptance?
The topic has been locked.
Support Specialist
10 years 5 months ago #56185 by alzander
Yeah, the extra parameters are tokens, which won't cause any issues with Facebook. Those tokens are sent when you authenticate using the server method as well (no popup).

The big difference between using the popup and not is that when the popup is disabled, there's first a call to your server to start the authentication process which JFBConnect then uses to redirect the user to Facebook.com. It seems like there's something wrong with that redirection when your server is called that's causing the problem. I don't know what the problem is, but hopefully that gets you a starting point if you really don't like the popup method.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
10 years 5 months ago #56210 by haibar
I don't mind the popup - but if you see screencast.com/t/AE2XXmr1ko - you'll see that this popup box is far too large. Where can I adjust the size of this box (autologin)? It doesn't stay on the screen long enough to debug and capture the CSS classes, etc. If I can style this popup better, I'll keep it.
The topic has been locked.
Support Specialist
10 years 5 months ago #56212 by alzander
You can turn that message off with the "Show Logging In Message" setting. That shouldn't affect authentication at all.

To fix though, add the following to your CSS:
.sourcecoast.modal {
    bottom: inherit;
}
To debug something like that, simply hit Esc right when it appears. That will stop the page from loading/redirecting and you can inspect the element however long you want.

I hope that helps!
Alex
The topic has been locked.