I am using Yii2, GoogleOAuth and yii2-user extension. I want to receive user google circles and set scope to my config:
\'authClientCollection\' => [
Use return URL in main.php like
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'authUrl' => 'https://www.facebook.com/dialog/oauth?display=popup',
'clientId' => ['FacebookClientId'],
'clientSecret' => ['FacebookClientSecret'],
'attributeNames' => ['name','first_name','last_name','email','gender','picture','age_range']
],
'google' => [
'class' => 'yii\authclient\clients\Google',
'clientId' => ['GoogleClientId'],
'clientSecret' => ['GoogleClientSecret'],
'returnUrl' => 'http://yoursite.com/site/auth?authclient=google'
],
],
],
Also set redirect_url in api credentials same as return url
It's work for me.
I was also facing this problem and got solution to change the Redirect URI in project Credentials like below:
Redirect URIs
http://mysiteurl.com/user/sign-in/oauth?authclient=google
http://mysiteurl.com/oauth2callback
JavaScript origins
http://mysiteurl.com
You can also add returnUrl
explicitly in your auth client configuration. Look at docs for more info.