I’ve got everything installed (the module, HybridAuth library and colorbox) and setup and Twitter is working great to authenticate users. After setting up Facebook and trying to login I get the error “There was an error processing your request“ and the message in my log says “Exception: Authentification failed! Facebook returned an invalide user id. in Hybrid_Auth::initialize() (line 156 of /home/fillmore/public_html/dev/sites/all/libraries/hybridauth/Hybrid/Auth.php).”

I traced my steps setting up the Facebook app and the module’s Facebook settings and everything looks correct. Is there anything else I need to do beyond setting up the Facebook app and entering the necessary information into the HybridAuth Facebook setup screen? I've never created a Facebook app before and the only part of the process that I was unsure about was the Hosting URL: https://frozen-sands-1400.herokuapp.com/ Is it ok to use "heroku" as the app hosting provider? Facebook doesn't seem to give me any other choice.

My internet search "hybridauth Facebook returned an invalide user id" led me here https://developers.facebook.com/docs/howtos/login/getting-started/ so I added the code to my html file but it had no effect.

Thank you for your help and thanks for this great module!
Scott

CommentFileSizeAuthor
#17 report_error.JPG48.99 KBzakmail007
facebook-app.jpg102.53 KBSc0tt
drupal-hybridauth.jpg78.67 KBSc0tt

Comments

duozersk’s picture

Assigned: Unassigned » duozersk

Scott,

After doing dome research on your issue it appears that it is in the HybridAuth library itself, not in the Drupal module code.
https://groups.google.com/forum/#!topic/hybridauth/R2rfDe_6O2c

It was fixed on GitHub and there are pull requests to the main library code:
https://github.com/hybridauth/hybridauth/pull/41
https://github.com/hybridauth/hybridauth/pull/70

From comments it looks like you just need to replace the files in hybridauth\Hybrid\thirdparty\Facebook with the latest Facebook SDK files.

Hope it helps.

Thanks
AndyB

duozersk’s picture

Status: Active » Closed (fixed)

So to fix this issue you need to download https://github.com/dorongutman/hybridauth/archive/master.zip and then replace these 4 files:
sites\all\libraries\hybridauth\hybridauth\Hybrid\Providers\Facebook.php
sites\all\libraries\hybridauth\hybridauth\Hybrid\thirdparty\Facebook\base_facebook.php
sites\all\libraries\hybridauth\hybridauth\Hybrid\thirdparty\Facebook\facebook.php
sites\all\libraries\hybridauth\hybridauth\Hybrid\thirdparty\Facebook\fb_ca_chain_bundle.crt

Thanks
AndyB

kvhdude’s picture

Just want to note that i am also seeing the same issue (even after updating hybridauth library to latest (Feb 9 2013).

Exception: Authentication failed! Facebook returned an invalid user id. in Hybrid_Auth::initialize() (line 147 ..... apps/drupal/htdocs/sites/all/libraries/hybridauth/hybridauth/Hybrid/Auth.php)

thanks
/jerry

kvhdude’s picture

Sorry for reviving this closed thread. It appears my issue was caused by the associated FB app inadvertently marked to be in sandbox mode. posting here so it might help others.

/jerry

duozersk’s picture

Jerry,

Thanks for the update!

AndyB

jooplaan’s picture

Status: Closed (fixed) » Active

Sorry to open this issue (again). I get the same error:

"Exception: Authentication failed! Facebook returned an invalid user id. in Hybrid_Auth::initialize() (line 147"

Steps to reproduce:

  • Make sure that you are logged in to Facebook
  • Now go the website that is using the HybridAuth module and the HybridAuth library

Now open another tab, go to Facebook and log out. Then close the tab and try to log in on the website using the HybridAuth module. It works!

So I only get the error, when I am already logged into Facebook. I am using the latest version of the HybridAuth library.

Any idea's how to fix this?

duozersk’s picture

Joop,

Can you please try to reproduce this behavior on the demo site? http://andrewberezovsky.ru/demo/hybridauth7/
Cause if it works fine on the demo site - then something is wrong on your site installation, and not in the module code. We need to figure out where the issue comes from.

Thanks
AndyB

jooplaan’s picture

Thanks. On the demo website it seems not a problem to login when I am already logged in to Facebook. So the problem seems on my side. Any pointers how to debug this? I tried disabling the modules I installed after Hybrid_Auth, but the problem remains the same.

duozersk’s picture

Joop,

First of all, get the latest 7.x-2.x-dev release and see if the issue is present with it.

Thanks
AndyB

jooplaan’s picture

Using the latest 7.x-2.x-dev release and the latest HybridAuth library the problem was solved.

Thanks!

duozersk’s picture

Status: Active » Closed (fixed)

Then closed (fixed).

ajaynimbolkar’s picture

Issue summary: View changes

Hi

Can any one help me with this issue of

"Authentication failed! Facebook returned an invalid user id." in drupal 6 website

I am using

HybridAuth 6*2.0 module as well as downloaded latest HybridAuth library from git hub version as hybridauth-2.2.2.

I have also created application id and secreate key of the Facebook and this application not in sandbox.

please suggest what was wrong

Looking help....

Thanks,
Ajay

Vultures’s picture

Looks like it's not a HybridAuth issue.
We fixed the same issue on our side by modifying FB library from github.

protected function getUserFromAccessToken() {
    try {
      $user_info = $this->api('/me');
      return $user_info['id'];
    } catch (FacebookApiException $e) {
      $number_redirect = isset($_GET['jredirects']) ? (int) $_GET['jredirects'] : 0;
      if( $number_redirect < 5 ){
        $number_redirect++;
        $url = $this->getLoginUrl() . '&jredirects=' . $number_redirect;
        header('Location: ' . $url);
        exit;
      }
      return 0;
    }
  }

If anyone has a better idea of how to fix this issue, don't hesitate to post it here :)

ajaynimbolkar’s picture

Hi Vultures,

I have try solution provide by you #13 but it was not working,Could you please provide your library in zip or some location where i can download and check the same.
As well as provide version of hybrid library your using.

looking for help.

Thanks,
Ajay

arun ak’s picture

Hi,

I am also facing the same issue. But in my case this issue happening only when I move the functionality in to the server.

In my local everything is working fine.

Looking help....

Thanks

ajaynimbolkar’s picture

Hi Arun,

Could you please provide me version of module as well as version of library you using?

Or you can also provide me link.

Thanks,
Ajay

zakmail007’s picture

StatusFileSize
new48.99 KB

I am facing the same issue please see attached image. I tried above solutions but still not working.
I am working on localhost using WAMP server. its very urgent for me.

tomtech’s picture

I just encountered this issue.

I tried some of the solutions posted here and elsewhere, though I skipped some as too insecure.

For me the issue was this:

1) I specified a whitelist IP address in IPv4 format.
2) the server was talking to Facebook over IPv6.

IPv4 <> IPv6

The solution for me was to add the IPv6 address to the whitelist.

After that, the issue was resolved in my case.

zeroduh’s picture

anybody’s picture

If you should run into these problems please see and comment #2684015: Authentication failed! Facebook returned an invalid user id