Skip to content

Commit 68afb03

Browse files
committed
allow oauth version in config
1 parent dfd188e commit 68afb03

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

src/SocialiteManager.php

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,24 @@ protected function createGitlabDriver()
113113
)->setHost($config['host'] ?? null);
114114
}
115115

116+
/**
117+
* Create an instance of the specified driver.
118+
*
119+
* @return \Laravel\Socialite\One\AbstractProvider
120+
*/
121+
protected function createTwitterDriver()
122+
{
123+
$config = $this->config->get('services.twitter');
124+
125+
if (($config['oauth'] ?? null) === 2) {
126+
return $this->createTwitterOAuth2Driver();
127+
}
128+
129+
return new TwitterProvider(
130+
$this->container->make('request'), new TwitterServer($this->formatConfig($config))
131+
);
132+
}
133+
116134
/**
117135
* Create an instance of the specified driver.
118136
*
@@ -143,20 +161,6 @@ public function buildProvider($provider, $config)
143161
);
144162
}
145163

146-
/**
147-
* Create an instance of the specified driver.
148-
*
149-
* @return \Laravel\Socialite\One\AbstractProvider
150-
*/
151-
protected function createTwitterDriver()
152-
{
153-
$config = $this->config->get('services.twitter');
154-
155-
return new TwitterProvider(
156-
$this->container->make('request'), new TwitterServer($this->formatConfig($config))
157-
);
158-
}
159-
160164
/**
161165
* Format the server configuration.
162166
*

0 commit comments

Comments
 (0)