Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google: Authentication failed #192

Closed
gaurav112 opened this issue Dec 2, 2016 · 10 comments
Closed

Google: Authentication failed #192

gaurav112 opened this issue Dec 2, 2016 · 10 comments

Comments

@gaurav112
Copy link

I am getting this issue since last 2 days trying to figure the problem but no luck.

Oops! We ran into an issue.
Authentication failed. Either you have cancelled the authentication or Google refused the connection.
Authentication failed! Google returned an invalid code 4/xDid_D2DefHLkUldAp6CCbJNzS4FoBMHRdoMzn-Nov8
400. { “error” : “invalid_request” }

so can anyone please help me out to resolve this issue.

@shanepinnell
Copy link

I am seeing the same thing, any resolution yet?

@skylerah
Copy link

skylerah commented Dec 6, 2016

Running into the same issue. Really need some information around this.

@psyntium
Copy link

psyntium commented Dec 7, 2016

I've managed to fix this. Seems need to update the google token_url endpoint. These are the changes that I made to make this work:

Filename: hybridauth/Hybrid/Providers/Google.php line 31:
$this->api->token_url = "https://www.googleapis.com/oauth2/v4/token";

Filename: hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php
add these lines:

if (strpos($this->token_url, "googleapis") !== false)
	array_push($this->curl_header, 'Content-Type: application/x-www-form-urlencoded');

Before:
$response = $this->request( $this->token_url, $params, $this->curl_authenticate_method );

Replace this line:
if($params) curl_setopt( $ch, CURLOPT_POSTFIELDS, $params );
With:

if($params) {
	if (in_array('Content-Type: application/x-www-form-urlencoded', $this->curl_header))
		curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query($params) );
	else
		curl_setopt( $ch, CURLOPT_POSTFIELDS, $params );
}

@gaurav112
Copy link
Author

Thanks this did the trick !!

@haluvibe
Copy link

So how long will this take to make it to a version update, I don't want to hack the plugin, just want to have to update it

@afarber
Copy link

afarber commented Dec 10, 2016

The author hasn't replied to anything since over 1 year.

@haluvibe
Copy link

oh

@haluvibe
Copy link

hacking it is then

@haluvibe
Copy link

haluvibe commented Dec 10, 2016

I confirm that psyntium suggested fix fixes this issue. Thank you for the fix and the very clear instructions.

@miled miled closed this as completed Jun 2, 2018
@surendrasoniblr
Copy link

No need to edit plugin. You need to enable Google + API to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants