laravel-fans / socialite-providers

Providers for Laravel Socialite
https://laravel-socialite-providers.github.io/socialite-providers/
MIT License
1 stars 1 forks source link

bug: WeChat Service Account scope snsapi_base conflict with snsapi_userinfo #10

Open sinkcup opened 5 years ago

sinkcup commented 5 years ago

config/services.php

    'wechat_service_account' => [
        'client_id' => env('WECHAT_SERVICE_ACCOUNT_APP_ID'),
        'client_secret' => env('WECHAT_SERVICE_ACCOUNT_APP_SECRET'),
        'redirect' => env('WECHAT_SERVICE_ACCOUNT_CALLBACK_URL'),
        'scopes' => 'snsapi_base',
    ],
    public function redirectToProvider($provider)
    {
        return Socialite::driver($provider)
            ->scopes(config("services.{$provider}.scopes"))
            ->redirect();
    }

expected result:

https://open.weixin.qq.com/connect/oauth2/authorize?redirect_uri=http%3A%2F%2Fexample.com%2Flogin%2Fwechat-service-account%2Fcallback&scope=snsapi_base&response_type=code&state=asdf&appid=wxdb123456

result:

https://open.weixin.qq.com/connect/oauth2/authorize?redirect_uri=http%3A%2F%2Fexample.com%2Flogin%2Fwechat-service-account%2Fcallback&scope=snsapi_userinfo%2Csnsapi_base&response_type=code&state=asdf&appid=wxdb123456

image