Merge pull request #1883 from procchio6/fix/oauth
Fix azure oauth not recognizing tenant ID
This commit is contained in:
@@ -6,19 +6,30 @@ use Laravel\Socialite\Facades\Socialite;
|
||||
function get_socialite_provider(string $provider)
|
||||
{
|
||||
$oauth_setting = OauthSetting::firstWhere('provider', $provider);
|
||||
|
||||
if ($provider == 'azure') {
|
||||
$azure_config = new \SocialiteProviders\Manager\Config(
|
||||
$oauth_setting->client_id,
|
||||
$oauth_setting->client_secret,
|
||||
$oauth_setting->redirect_uri,
|
||||
['tenant' => $oauth_setting->tenant],
|
||||
);
|
||||
return Socialite::driver('azure')->setConfig($azure_config);
|
||||
}
|
||||
|
||||
$config = [
|
||||
'client_id' => $oauth_setting->client_id,
|
||||
'client_secret' => $oauth_setting->client_secret,
|
||||
'redirect' => $oauth_setting->redirect_uri,
|
||||
'tenant' => $oauth_setting->tenant,
|
||||
];
|
||||
|
||||
$provider_class_map = [
|
||||
'azure' => \SocialiteProviders\Azure\Provider::class,
|
||||
'bitbucket' => \Laravel\Socialite\Two\BitbucketProvider::class,
|
||||
'github' => \Laravel\Socialite\Two\GithubProvider::class,
|
||||
'gitlab' => \Laravel\Socialite\Two\GitlabProvider::class,
|
||||
'google' => \Laravel\Socialite\Two\GoogleProvider::class,
|
||||
];
|
||||
|
||||
return Socialite::buildProvider(
|
||||
$provider_class_map[$provider],
|
||||
$config
|
||||
|
||||
Reference in New Issue
Block a user