Google 401 Invalid Credentials #694

Closed
andsh opened this Issue Oct 28, 2016 · 4 comments

Projects

None yet

5 participants

@andsh
andsh commented Oct 28, 2016

I have hybridauth work successfully for facebook but I face a strange problem with Google
First of all, I need only to authenticate a user and get his profileid, name and email without any access to his contacts or drive.
So, my scope in the config is set as "scope"=> "https://www.googleapis.com/auth/userinfo.profile "."https://www.googleapis.com/auth/userinfo.email","access_type" => "online"

When I try to loginq i get this error
[28-Oct-2016 18:49:34 Europe] Enter [Google]::logout()
[28-Oct-2016 18:53:09 Europe] Enter [Google]::setUserConnected()
[28-Oct-2016 18:53:10 Europe] PHP Fatal error: Uncaught Exception: User profile request failed! Google returned an invalid response:stdClass::__set_state(array(
'error' =>
stdClass::__set_state(array(
'errors' =>
array (
0 =>
stdClass::__set_state(array(
'domain' => 'global',
'reason' => 'authError',
'message' => 'Invalid Credentials',
'locationType' => 'header',
'location' => 'Authorization',
)),
),
'code' => 401,
'message' => 'Invalid Credentials',
)),
)) in /var/www/html/hybridauth/Hybrid/Providers/Google.php:90
Stack trace:
#0 /var/www/html/hybridauth/Hybrid/Endpoint.php(202): Hybrid_Providers_Google->getUserProfile()
#1 /var/www/html/hybridauth/Hybrid/Endpoint.php(74): Hybrid_Endpoint->processAuthDone()
#2 /var/www/html/hybridauth/Hybrid/Endpoint.php(91): Hybrid_Endpoint->__construct(Array)
#3 /var/www/html/hybridauth/index.php(30): Hybrid_Endpoint::process()
#4 {main}

thrown in /var/www/html/hybridauth/Hybrid/Providers/Google.php on line 90

At this momet my browser shows just a white screen on a callback URL which is
https://www.mydomain.com/hybridauth/?hauth.done=Google&code=xxx

If I hit F5 at this state, staying on the callback URL, I see that error, my User informatin is received successfully by Hybridauth!!!

Why does it stop on it?

@carolinex
carolinex commented Nov 15, 2016 edited

I'm having a similar problem. I successfully connected to my own Google Account, at first, requesting only basic profile.
Then I deauthorized the app in my account and added email to the scope list. Now I get the error mentioned by @andsh

@stormwalkerec

I also have this issue. Had a working site, and was working 100%, and now it stopped working with zero code changes

ERROR: Exception: User profile request failed! Google returned an invalid response:stdClass::__set_state(array(
'error' =>
stdClass::__set_state(array(
'errors' =>
array (
0 =>
stdClass::__set_state(array(
'domain' => 'global',
'reason' => 'authError',
'message' => 'Invalid Credentials',
'locationType' => 'header',
'location' => 'Authorization',
)),
),
'code' => 401,
'message' => 'Invalid Credentials',
)),
)) in /data/web/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Providers/Google.php:90
Stack trace:
#0 /data/web/vendor/hybridauth/hybridauth/hybridauth/Hybrid/Provider_Adapter.php(242): Hybrid_Providers_Google->getUserProfile()
#1 /data/web/oauth_google.php(19): Hybrid_Provider_Adapter->__call('getUserProfile', Array)
#2 {main}

@neo22s
Contributor
neo22s commented Dec 9, 2016

Same exact error here

Error: please try again! User profile request failed! Google returned an error: Exception: The Authorization Service has return: invalid_request in /home/opencl7/public_html/2181/oc/common/vendor/hybridauth/hybridauth/Hybrid/thirdparty/OAuth/OAuth2Client.php:85 Stack trace: #0 /home/opencl7/public_html/2181/oc/common/vendor/hybridauth/hybridauth/Hybrid/Provider_Model_OAuth2.php(120): OAuth2Client->authenticate('4/_tNah5g6PK2Fu...') #1 /home/opencl7/public_html/2181/oc/common/vendor/hybridauth/hybridauth/Hybrid/Endpoint.php(173): Hybrid_Provider_Model_OAuth2->loginFinish() #2 /home/opencl7/public_html/2181/oc/common/vendor/hybridauth/hybridauth/Hybrid/Endpoint.php(55): Hybrid_Endpoint->processAuthDone() #3 /home/opencl7/public_html/2181/oc/common/vendor/hybridauth/hybridauth/Hybrid/Endpoint.php(72): Hybrid_Endpoint->__construct(Array) #4 /home/opencl7/public_html/2181/oc/common/classes/controller/social.php(19): Hybrid_Endpoint::process(Array) #5 /home/opencl7/public_html/2181/oc/kohana/system/classes/Kohana/Controller.php(84): Controller_Social->action_login() #6 [internal function]: Kohana_Controller->execute() #7 /home/opencl7/public_html/2181/oc/kohana/system/classes/Kohana/Request/Client/Internal.php(97): ReflectionMethod->invoke(Object(Controller_Social)) #8 /home/opencl7/public_html/2181/oc/kohana/system/classes/Kohana/Request/Client.php(114): Kohana_Request_Client_Internal->execute_request(Object(Request), Object(Response)) #9 /home/opencl7/public_html/2181/oc/kohana/system/classes/Kohana/Request.php(993): Kohana_Request_Client->execute(Object(Request)) #10 /home/opencl7/public_html/2181/index.php(146): Kohana_Request->execute() #11 {main} - See more at: http://2181.dontcode.com/#sthash.yZspjemu.dpuf

@neo22s
Contributor
neo22s commented Dec 9, 2016

Hello! fix here: #707

@lunanovaz lunanovaz referenced this issue in mistic100/Piwigo-Social-Connect Dec 29, 2016
Closed

Google provider : error code 6 #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment