我需要动态配置我的供应商。
$config = [ 'client_id' = 'xxxxxxx', 'client_token' = 'xxxxxxx', 'redirect' = 'http://example.com/' ]; return Socialite::with($provider)->setConfig($config)->redirect();
但不幸的是没有函数setConfig。
我需要动态设置 provider、client_id、client_secret 和重定向
有什么想法吗?
谢谢!
最佳答案
您可以像这样使用 Socialite buildProvider
方法:
$config = [
'client_id' = 'xxxxxxx',
'client_token' = 'xxxxxxx',
'redirect' = 'http://example.com/'
];
return Socialite::buildProvider(\Laravel\Socialite\Two\FacebookProvider::class, $config);
\Laravel\Socialite\Two\FacebookProvider::class
将与文件夹 One
/Two 中提供的服务(如果不同)交换
在 https://github.com/laravel/socialite/tree/2.0/src
关于php - 动态 Laravel 社会名流配置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39999022/