public function socialite_config($provider = false)
{
$callback_url = api_url('social_login_process?provider=' . $provider);
if (get_option('enable_user_fb_registration', 'users') == 'y') {
Config::set('services.facebook.client_id', get_option('fb_app_id', 'users'));
Config::set('services.facebook.client_secret', get_option('fb_app_secret', 'users'));
Config::set('services.facebook.redirect', $callback_url);
}
if (get_option('enable_user_twitter_registration', 'users') == 'y') {
Config::set('services.twitter.client_id', get_option('twitter_app_id', 'users'));
Config::set('services.twitter.client_secret', get_option('twitter_app_secret', 'users'));
Config::set('services.twitter.redirect', $callback_url);
}
if (get_option('enable_user_google_registration', 'users') == 'y') {
Config::set('services.google.client_id', get_option('google_app_id', 'users'));
Config::set('services.google.client_secret', get_option('google_app_secret', 'users'));
Config::set('services.google.redirect', $callback_url);
}
if (get_option('enable_user_github_registration', 'users') == 'y') {
Config::set('services.github.client_id', get_option('github_app_id', 'users'));
Config::set('services.github.client_secret', get_option('github_app_secret', 'users'));
Config::set('services.github.redirect', $callback_url);
}
if (get_option('enable_user_linkedin_registration', 'users') == 'y') {
Config::set('services.linkedin.client_id', get_option('linkedin_app_id', 'users'));
Config::set('services.linkedin.client_secret', get_option('linkedin_app_secret', 'users'));
Config::set('services.linkedin.redirect', $callback_url);
}
if (get_option('enable_user_microweber_registration', 'users') == 'y') {
$svc = Config::get('services.microweber');
if (!isset($svc['client_id'])) {
Config::set('services.microweber.client_id', get_option('microweber_app_id', 'users'));
}
if (!isset($svc['client_secret'])) {
Config::set('services.microweber.client_secret', get_option('microweber_app_secret', 'users'));
}
if (!isset($svc['redirect'])) {
Config::set('services.microweber.redirect', $callback_url);
}
$this->socialite->extend('microweber', function ($app) {
$config = $app['config']['services.microweber'];
return $this->socialite->buildProvider('\\Microweber\\Providers\\Socialite\\MicroweberProvider', $config);
});
}
}