diff --git a/app/Models/OauthSetting.php b/app/Models/OauthSetting.php index 3d82e89f2..bfd332c87 100644 --- a/app/Models/OauthSetting.php +++ b/app/Models/OauthSetting.php @@ -25,11 +25,11 @@ class OauthSetting extends Model { switch ($this->provider) { case 'azure': - return filled($this->client_id) && filled($this->client_secret) && filled($this->redirect_uri) && filled($this->tenant); + return filled($this->client_id) && filled($this->client_secret) && filled($this->tenant); case 'authentik': - return filled($this->client_id) && filled($this->client_secret) && filled($this->redirect_uri) && filled($this->base_url); + return filled($this->client_id) && filled($this->client_secret) && filled($this->base_url); default: - return filled($this->client_id) && filled($this->client_secret) && filled($this->redirect_uri); + return filled($this->client_id) && filled($this->client_secret); } } } diff --git a/bootstrap/helpers/socialite.php b/bootstrap/helpers/socialite.php index 16870e33d..fe19752cb 100644 --- a/bootstrap/helpers/socialite.php +++ b/bootstrap/helpers/socialite.php @@ -7,6 +7,10 @@ function get_socialite_provider(string $provider) { $oauth_setting = OauthSetting::firstWhere('provider', $provider); + if (! filled($oauth_setting->redirect_uri)) { + $oauth_setting->update(['redirect_uri' => route('auth.callback', $provider)]); + } + if ($provider === 'azure') { $azure_config = new \SocialiteProviders\Manager\Config( $oauth_setting->client_id, diff --git a/resources/views/livewire/settings-oauth.blade.php b/resources/views/livewire/settings-oauth.blade.php index 7062ef4d4..76d03dc14 100644 --- a/resources/views/livewire/settings-oauth.blade.php +++ b/resources/views/livewire/settings-oauth.blade.php @@ -26,7 +26,7 @@ label="Client ID" /> - @if ($oauth_setting->provider == 'azure')