Myk*_*pov 1 php oauth oauth-2.0 laravel laravel-socialite
我需要动态配置我的提供程序。
Run Code Online (Sandbox Code Playgroud)$config = [ 'client_id' = 'xxxxxxx', 'client_token' = 'xxxxxxx', 'redirect' = 'http://example.com/' ]; return Socialite::with($provider)->setConfig($config)->redirect();
但不幸的是,没有功能setConfig。
我需要设置提供程序,client_id,client_secret并动态重定向
有什么想法吗?
谢谢!
您可以使用buildProvider类似Socialite的方法:
$config = [
'client_id' = 'xxxxxxx',
'client_token' = 'xxxxxxx',
'redirect' = 'http://example.com/'
];
return Socialite::buildProvider(\Laravel\Socialite\Two\FacebookProvider::class, $config);
Run Code Online (Sandbox Code Playgroud)
哪里\Laravel\Socialite\Two\FacebookProvider::class会与您的服务(如不同)来作为交换或者文件夹中提供One/ Two中https://github.com/laravel/socialite/tree/2.0/src