public function service($provider, $url = null, $scope = null)
{
$info = Config::get('laravel-social::providers.' . strtolower($provider));
if (empty($info) || !is_array($info)) {
throw new Exception('Missing configuration details for Social service: ' . $provider);
}
$client_id = array_get($info, 'client_id');
$client_secret = array_get($info, 'client_secret');
$scope = is_null($scope) ? array_get($info, 'scope') : $scope;
if (empty($client_id) || empty($client_secret)) {
throw new Exception('Missing client id/secret for Social service: ' . $provider);
}
return $this->factory->createService(ucfirst($provider), new Credentials($client_id, $client_secret, $url ?: URL::current()), $this->storage, $scope);
}