yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

Google0Auth - Exception – yii\authclient\InvalidResponseException #7504

Closed evercode1 closed 9 years ago

evercode1 commented 9 years ago

I was able to connect and authorize Google via yii2authclient, however it is returning the following error:

Exception – yii\authclient\InvalidResponseException

Request failed with code: 401, message: { "error" : "invalid_client" }

Full Gist of error:

https://gist.github.com/evercode1/2116653dfdd765facda2

This seems like bug because I copied the config right out of the guide:

'google' => [ 'class' => 'yii\authclient\clients\GoogleOAuth', 'clientId' => 'my_id', 'clientSecret' => 'my_secret', ],

Obviously I have plugged in the appropriate values for my_id and my_secret. Also, I have successfully setup Facebook, Github and Twitter using Yii2 authclient, so my actions method and onAuthSuccess methods are working properly for those providers.

I did have a problem where Google was encoding my callback url, but I fixed that by switching to pretty url.

klimov-paul commented 9 years ago

Unable to reproduce. Ensure you have setup your application at Google correctly and put its credentials at config correctly.

pleasereachmeoutonmoeinxyz commented 9 years ago

I have same problem on shared host The error occurred when google return user back to site ,I think it's about curl.

evercode1 commented 9 years ago

The problem I experienced was on my end. I had the configuration wrong, even though it was giving me that Exception – yii\authclient\InvalidResponseException message. It had nothing to do with curl.