Hey,

I have the same problem as thisuser, but this issue seems to be closed already:
https://www.drupal.org/node/2511284

When clicking on "Login to Facebook", I get redirected to Facebook to authorize the permissions. After doing this, the page returns and the "Login to Facebook" link is still there (I've removed the cache already) instead of the Facebook information.

On localhost, everything works perfectly, but on the server it doesn't. I'm using the same Facebook app I created, so the problem seems to have to do something with the server: something is blocking the request, but I have no idea what.

Is there any PHP/firewall setting that could block this? Or anything else?

Thanks

CommentFileSizeAuthor
#11 websitefield.jpg72.89 KBBaher
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bjornv created an issue. See original summary.

Baher’s picture

Hi,

You have to go to Facebook permission, and then you select the role you are using and then submit.

Baher

Bjornv’s picture

Hey,

I've set the permissions correctly, but still nothing seems to happen.

Baher’s picture

Hi,

Maybe you have to add permission to Facebook developper tools. Go to App details, then App center listed platforms and click on button Configure app center permission, you have to select Fragement URI and then add manage_page and publish_page.

This is my video is in Frensh, but you can use the subtitle : https://youtu.be/W5vXb-EdsbE?t=1106

Regards
Baher

Bjornv’s picture

Unfortunately, that doesn't seem to fix the issue.

It all works fine on my local server, but it doesn't on the live one. It's likely something server related, but I have no idea what could be causing this..

Baher’s picture

did you changed the link of your website https://youtu.be/W5vXb-EdsbE ?

Bjornv’s picture

Do you mean on Facebook? Yes, I did.

Baher’s picture

can you send a picture how you entered the value to the field on facebook

Bjornv’s picture

What field do you mean exactly?

But on my local server I can get it to work, it's just when using the live server this issue appears..

Baher’s picture

FileSize
72.89 KB

website field. look on the picture

Bjornv’s picture

I've entered it in this format:

http://www.website.com/

I've also tried different formats already, but without luck.

sumithra ramalingam’s picture

Even I'm also facing same issue.
Everything works fine in my local, but doesn't on the live server.
More than one week i'm struggling with this issues :(. Please help me folks.

Bjornv’s picture

I've debugged the whole code and believe I have found the cause of this issue. You might also want to check this out sumithra ramalingam, if none of the other solutions on the internet seem to work.

In the SDK (base_facebook.php), there's a function getAccessTokenFromCode with this code:

    try {
      // need to circumvent json_decode by calling _oauthRequest
      // directly, since response isn't JSON format.
      $access_token_response =
        $this->_oauthRequest(
          $this->getUrl('graph', '/oauth/access_token'),
          $params = array('client_id' => $this->getAppId(),
                          'client_secret' => $this->getAppSecret(),
                          'redirect_uri' => $redirect_uri,
                          'code' => $code));
    } catch (FacebookApiException $e) {
      // most likely that user very recently revoked authorization.
      // In any event, we don't have an access token, so say so.
      return false;
    }

Here it seems to go wrong. An exception occured, but isn't handled at all. Printing the error, I get:
Failed to connect to 2a03:2880:20:4f06:face:b00c:0:1: Network is unreachable

Adding CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4 in $CURL_OPTS should normally force it to use ipv4, however, in my case an exception still occurs telling me there's a timeout.

I think something is misconfigured or blocked on the server side. I don't manage the server, so I have to wait until the server guys can have a look at it.

Baher’s picture

sumithra ramalingam’s picture

Hi Bjornv, I have gone through the fb_autopost.module file. I believe there is an issue with fb_autopost_facebook_login() function.
Here access token is not printing anything. But I don't know exactly the problem is on server side or developer side. Please help me out.

Bjornv’s picture

After some adjustments on the servers, it now works fine! My issue was indeed related to the ipv6 configuration on the server and the firewall blocking certain CURL requests.

I also had the problem of not getting the access token. This was because of the above issue.

sumithra ramalingam, to confirm that you have the same issue as me, find the code I posted above and add these lines above "return false;":

var_dump($e);
die;

If you try to login to Facebook now and you have the same issue as me, you should get a white page with debugging information. Don't forget to remove the lines again afterwards.

sumithra ramalingam’s picture

Bjornv, I have added your code above return false. But I didn't any white page with debugging information.
Actually it is not going inside the catch function.
I think, I have to verify with server guys.

Bjornv’s picture

In that case, you have a different problem. When I was looking for solutions, I found a lot of different causes for this...