yii2, google outh2 and scope

前端 未结 3 1293
陌清茗
陌清茗 2021-01-05 08:43

I am using Yii2, GoogleOAuth and yii2-user extension. I want to receive user google circles and set scope to my config:

\'authClientCollection\' => [
             


        
3条回答
  •  梦毁少年i
    2021-01-05 09:08

    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.
    

提交回复
热议问题