All of the providers work but Google, which gave me an error when firing the $hybridauth->authenticate method. The error was that the response_type parameter was missing. I edited line 58 in the OAuth2Client.php file provided with the hybridauth library to use the 'url' function provided by Drupal instead of the http_build_query function provided by PHP and authenticating with the Google provider worked. Anyone have a better solution?

CommentFileSizeAuthor
#2 google_error.png55.3 KBnicholasyonko

Comments

rwohleb’s picture

Assigned: Unassigned » rwohleb
Status: Active » Postponed (maintainer needs more info)

Can you provide the full error message? I haven't seen this issue.

nicholasyonko’s picture

StatusFileSize
new55.3 KB

It returns a Google page simply saying that the response_type parameter is missing as show in the attached image. When the url is expanded, the response type is there. I have my site hosted on Acquia and am unsure if that impacts how the hybridauth library sends the uri to Google. I have no access that I can see to the raw php logs or the http logs.

rwohleb’s picture

Your Acquia setup shouldn't be an issue. What version of the HybridAuth library are you using?

Also, can you give me the full URL when you get that error msg? Please X out the numbers in the URL when you post it... just in case.

nicholasyonko’s picture

The HybridAuth Library I am using is 2.0.11-dev.

The URL is https://accounts.google.com/o/oauth2/auth?client_id=&redirect_uri=http%3A%2F%2F%2Fhybridauth%2Fendpoint%3Fhauth.done%3DGoogle&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapi...

nicholasyonko’s picture

Additional info on this - it is an issue with the hybridauth library perhaps?

http://groups.google.com/group/hybridauth/browse_thread/thread/e4bb0dee4...

spazfox’s picture

Version: 7.x-1.x-dev » 7.x-2.3

I'm experiencing the same problem with Google authorization. Can you provide more detail on what you changed in the OAuth2Client.php file to make it work for you?

duozersk’s picture

Title: Google - response_type parameter missing » Google - response_type pararmeter missing
Status: Closed (fixed) » Fixed

Hey guys,

I have just met this issue when developing the 6.x-2.x branch. It was throwing the same error message for me and it is related to the PHP setting "arg_separator.output" being set to "&" (or it may be smth else, just not "&"). You can check this setting in your phpinfo output - it is available from the standard "Status report" on any Drupal installation (just click on the PHP version number or more information link near PHP version number).

Drupal 6 has this line in the settings.php file:
ini_set('arg_separator.output', '&');
When you comment it out - everything starts working fine (it worked for me, you might need to change '&' to '&'). For Drupal 7 installations you should check your PHP setup so that the "arg_separator.output" is set to just "&" and not "&".

Another way to fix it is to patch hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php near Line 64 (but I would strongly recommend to check and change the PHP setting above):

- return $this->authorize_url . "?" . http_build_query( $params );
+ return $this->authorize_url . "?" . http_build_query( $params, '', '&' );

Hope this helps.
Thanks
AndyB

duozersk’s picture

Title: Google - response_type pararmeter missing » Google - response_type parameter missing
Assigned: rwohleb » duozersk
Category: bug » support
Status: Postponed (maintainer needs more info) » Fixed

Correcting the typo in the issue title.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

queryblitz’s picture

#7 worked for me, thank you! Had to edit the OAuth2Client.php file like you said.

mrded’s picture

#7 Thank you! It works for me

drpchris’s picture

Title: Google - response_type pararmeter missing » Google - response_type parameter missing
Status: Fixed » Closed (fixed)

#7 worked for me also. I changed it in the OAuth2Client.php file. Changing it in the settings.php file seems wrong, since the problem is with this module specifically. Maybe there can be setting for the module to change the separator just for Google or various logins?

shark’s picture

Changing the php setting as suggested in #7 worked for me as well. Thanks.

Also, somewhat related, the Drupal for Facebook module had the same issue.