An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat(auth): Add Clerk OAuth Provider (#5553)
Yassir Elmarissia77bd8825824
diff --git a/.cursor/rules/security-patterns.mdc b/.cursor/rules/security-patterns.mdcindex 85c48c035c..9cdbcaa0c1 100644--- a/.cursor/rules/security-patterns.mdc+++ b/.cursor/rules/security-patterns.mdc@@ -21,6 +21,7 @@ Coolify implements **defense-in-depth security** with multiple layers of protect- **Supported Providers**:- Google OAuth- Microsoft Azure AD+ - Clerk- Authentik- Discord- GitHub (via GitHub Apps)diff --git a/.cursor/rules/technology-stack.mdc b/.cursor/rules/technology-stack.mdcindex 3082b9c3e2..81a2e3bb3a 100644--- a/.cursor/rules/technology-stack.mdc+++ b/.cursor/rules/technology-stack.mdc@@ -90,7 +90,7 @@ alwaysApply: false- **Purpose**: OAuth provider integration- **Providers**:- GitHub, GitLab, Google- - Microsoft Azure, Authentik, Discord+ - Microsoft Azure, Authentik, Discord, Clerk- Custom OAuth implementations## Background Processingdiff --git a/app/Models/OauthSetting.php b/app/Models/OauthSetting.phpindex bfd332c87c..08e08d85b1 100644--- a/app/Models/OauthSetting.php+++ b/app/Models/OauthSetting.php@@ -27,6 +27,7 @@ class OauthSetting extends Modelcase 'azure':return filled($this->client_id) && filled($this->client_secret) && filled($this->tenant);case 'authentik':+ case 'clerk':return filled($this->client_id) && filled($this->client_secret) && filled($this->base_url);default:return filled($this->client_id) && filled($this->client_secret);diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.phpindex 0678100df4..48c3c3e4ff 100644--- a/app/Providers/EventServiceProvider.php+++ b/app/Providers/EventServiceProvider.php@@ -9,6 +9,7 @@ use Illuminate\Foundation\Events\MaintenanceModeEnabled;use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;use SocialiteProviders\Authentik\AuthentikExtendSocialite;use SocialiteProviders\Azure\AzureExtendSocialite;+use SocialiteProviders\Clerk\ClerkExtendSocialite;use SocialiteProviders\Discord\DiscordExtendSocialite;use SocialiteProviders\Google\GoogleExtendSocialite;use SocialiteProviders\Infomaniak\InfomaniakExtendSocialite;@@ -26,6 +27,7 @@ class EventServiceProvider extends ServiceProviderSocialiteWasCalled::class => [AzureExtendSocialite::class.'@handle',AuthentikExtendSocialite::class.'@handle',+ ClerkExtendSocialite::class.'@handle',DiscordExtendSocialite::class.'@handle',GoogleExtendSocialite::class.'@handle',InfomaniakExtendSocialite::class.'@handle',diff --git a/bootstrap/helpers/socialite.php b/bootstrap/helpers/socialite.phpindex 2ed1ed1c34..3ae70c9d61 100644--- a/bootstrap/helpers/socialite.php+++ b/bootstrap/helpers/socialite.php@@ -22,15 +22,15 @@ function get_socialite_provider(string $provider)return Socialite::driver('azure')->setConfig($azure_config);}- if ($provider == 'authentik') {- $authentik_config = new \SocialiteProviders\Manager\Config(+ if ($provider == 'authentik' || $provider == 'clerk') {+ $authentik_clerk_config = new \SocialiteProviders\Manager\Config($oauth_setting->client_id,$oauth_setting->client_secret,$oauth_setting->redirect_uri,['base_url' => $oauth_setting->base_url],);- return Socialite::driver('authentik')->setConfig($authentik_config);+ return Socialite::driver($provider)->setConfig($authentik_clerk_config);}if ($provider == 'google') {diff --git a/composer.json b/composer.jsonindex 2495dc1c81..bfe2b98b47 100644--- a/composer.json+++ b/composer.json@@ -39,6 +39,7 @@"resend/resend-laravel": "^0.17.0","sentry/sentry-laravel": "^4.13","socialiteproviders/authentik": "^5.2",+ "socialiteproviders/clerk": "^5.0","socialiteproviders/discord": "^4.2","socialiteproviders/google": "^4.1","socialiteproviders/infomaniak": "^4.0",diff --git a/composer.lock b/composer.lockindex 5794ac4822..22a0b2f354 100644--- a/composer.lock+++ b/composer.lock@@ -7483,6 +7483,17 @@"time": "2023-11-07T22:21:16+00:00"},{+ "name": "socialiteproviders/clerk",+ "version": "5.0.0",+ "source": {+ "type": "git",+ "url": "https://github.com/SocialiteProviders/Clerk.git",+ "reference": "41e123036001ff37851b9622a910010c0e487d6a"+ },+ "dist": {+ "type": "zip",+ "url": "https://api.github.com/repos/SocialiteProviders/Clerk/zipball/41e123036001ff37851b9622a910010c0e487d6a",+ "reference": "41e123036001ff37851b9622a910010c0e487d6a","name": "socialiteproviders/discord","version": "4.2.0","source": {@@ -7498,12 +7509,13 @@},"require": {"ext-json": "*",- "php": "^7.4 || ^8.0",- "socialiteproviders/manager": "~4.0"+ "php": "^8.0",+ "socialiteproviders/manager": "^4.4"},"type": "library","autoload": {"psr-4": {+ "SocialiteProviders\\Clerk\\": """SocialiteProviders\\Discord\\": ""}},@@ -7513,6 +7525,13 @@],"authors": [{+ "name": "Ignacio Cano",+ "email": "[email protected]"+ }+ ],+ "description": "Clerk OAuth2 Provider for Laravel Socialite",+ "keywords": [+ "clerk","name": "Christopher Eklund","email": "[email protected]"}@@ -7526,6 +7545,11 @@"socialite"],"support": {+ "docs": "https://socialiteproviders.com/clerk",+ "issues": "https://github.com/socialiteproviders/providers/issues",+ "source": "https://github.com/socialiteproviders/providers"+ },+ "time": "2024-02-19T12:17:59+00:00""docs": "https://socialiteproviders.com/discord","issues": "https://github.com/socialiteproviders/providers/issues","source": "https://github.com/socialiteproviders/providers"diff --git a/config/services.php b/config/services.phpindex d1c4a36995..cb1929bec1 100644--- a/config/services.php+++ b/config/services.php@@ -46,6 +46,13 @@ return ['redirect' => env('AUTHENTIK_REDIRECT_URI'),],+ 'clerk' => [+ 'client_id' => env('CLERK_CLIENT_ID'),+ 'client_secret' => env('CLERK_CLIENT_SECRET'),+ 'redirect' => env('CLERK_REDIRECT_URI'),+ 'base_url' => env('CLERK_BASE_URL'),+ ],+'google' => ['client_id' => env('GOOGLE_CLIENT_ID'),'client_secret' => env('GOOGLE_CLIENT_SECRET'),diff --git a/database/seeders/OauthSettingSeeder.php b/database/seeders/OauthSettingSeeder.phpindex 9adcb04d4c..06b37ca446 100644--- a/database/seeders/OauthSettingSeeder.php+++ b/database/seeders/OauthSettingSeeder.php@@ -17,6 +17,7 @@ class OauthSettingSeeder extends Seeder$providers = collect(['azure','bitbucket',+ 'clerk','discord','github','gitlab',diff --git a/lang/ar.json b/lang/ar.jsonindex 3a0e32fc37..263924c243 100644--- a/lang/ar.json+++ b/lang/ar.json@@ -3,6 +3,7 @@"auth.login.authentik": "تسجيل الدخول باستخدام Authentik","auth.login.azure": "تسجيل الدخول باستخدام Microsoft","auth.login.bitbucket": "تسجيل الدخول باستخدام Bitbucket",+ "auth.login.clerk": "تسجيل الدخول باستخدام Clerk","auth.login.discord": "تسجيل الدخول باستخدام Discord","auth.login.github": "تسجيل الدخول باستخدام GitHub","auth.login.gitlab": "تسجيل الدخول باستخدام Gitlab",diff --git a/lang/az.json b/lang/az.jsonindex 4bd437f6ac..92f56ddbc7 100644--- a/lang/az.json+++ b/lang/az.json@@ -3,6 +3,7 @@"auth.login.authentik": "Authentik ilə daxil ol","auth.login.azure": "Azure ilə daxil ol","auth.login.bitbucket": "Bitbucket ilə daxil ol",+ "auth.login.clerk": "Clerk ilə daxil ol","auth.login.discord": "Discord ilə daxil ol","auth.login.github": "Github ilə daxil ol","auth.login.gitlab": "GitLab ilə daxil ol",diff --git a/lang/cs.json b/lang/cs.jsonindex 83f7c3c556..00455aa81b 100644--- a/lang/cs.json+++ b/lang/cs.json@@ -2,6 +2,7 @@"auth.login": "Přihlásit se","auth.login.azure": "Přihlásit se pomocí Microsoftu","auth.login.bitbucket": "Přihlásit se pomocí Bitbucketu",+ "auth.login.clerk": "Přihlásit se pomocí Clerk","auth.login.discord": "Přihlásit se pomocí Discordu","auth.login.github": "Přihlásit se pomocí GitHubu","auth.login.gitlab": "Přihlásit se pomocí Gitlabu",diff --git a/lang/de.json b/lang/de.jsonindex 8388a2b087..9bb11fdb41 100644--- a/lang/de.json+++ b/lang/de.json@@ -2,6 +2,7 @@"auth.login": "Anmelden","auth.login.azure": "Mit Microsoft anmelden","auth.login.bitbucket": "Mit Bitbucket anmelden",+ "auth.login.clerk": "Mit Clerk anmelden","auth.login.discord": "Mit Discord anmelden","auth.login.github": "Mit GitHub anmelden","auth.login.gitlab": "Mit GitLab anmelden",diff --git a/lang/en.json b/lang/en.jsonindex d127de5a95..ae7c4a2c24 100644--- a/lang/en.json+++ b/lang/en.json@@ -3,6 +3,7 @@"auth.login.authentik": "Login with Authentik","auth.login.azure": "Login with Microsoft","auth.login.bitbucket": "Login with Bitbucket",+ "auth.login.clerk": "Login with Clerk","auth.login.discord": "Login with Discord","auth.login.github": "Login with GitHub","auth.login.gitlab": "Login with Gitlab",diff --git a/lang/es.json b/lang/es.jsonindex fde5b88051..73363a9bf0 100644--- a/lang/es.json+++ b/lang/es.json@@ -2,6 +2,7 @@"auth.login": "Iniciar Sesión","auth.login.azure": "Acceder con Microsoft","auth.login.bitbucket": "Acceder con Bitbucket",+ "auth.login.clerk": "Acceder con Clerk","auth.login.discord": "Acceder con Discord","auth.login.github": "Acceder con GitHub","auth.login.gitlab": "Acceder con Gitlab",diff --git a/lang/fa.json b/lang/fa.jsonindex 48d7facc3e..d68049e77a 100644--- a/lang/fa.json+++ b/lang/fa.json@@ -2,6 +2,7 @@"auth.login": "ورود","auth.login.azure": "ورود با مایکروسافت","auth.login.bitbucket": "ورود با Bitbucket",+ "auth.login.clerk": "ورود با Clerk","auth.login.discord": "ورود با Discord","auth.login.github": "ورود با گیت هاب","auth.login.gitlab": "ورود با گیت لب",diff --git a/lang/fr.json b/lang/fr.jsonindex ef2b26b9ba..2516d0f69d 100644--- a/lang/fr.json+++ b/lang/fr.json@@ -3,6 +3,7 @@"auth.login.authentik": "Connexion avec Authentik","auth.login.azure": "Connexion avec Microsoft","auth.login.bitbucket": "Connexion avec Bitbucket",+ "auth.login.clerk": "Connexion avec Clerk","auth.login.discord": "Connexion avec Discord","auth.login.github": "Connexion avec GitHub","auth.login.gitlab": "Connexion avec Gitlab",diff --git a/lang/id.json b/lang/id.jsonindex c77d656793..b0e38197aa 100644--- a/lang/id.json+++ b/lang/id.json@@ -3,6 +3,7 @@"auth.login.authentik": "Masuk dengan Authentik","auth.login.azure": "Masuk dengan Microsoft","auth.login.bitbucket": "Masuk dengan Bitbucket",+ "auth.login.clerk": "Masuk dengan Clerk","auth.login.discord": "Masuk dengan Discord","auth.login.github": "Masuk dengan GitHub","auth.login.gitlab": "Masuk dengan Gitlab",diff --git a/lang/it.json b/lang/it.jsonindex f867d26965..c0edc314bd 100644--- a/lang/it.json+++ b/lang/it.json@@ -3,6 +3,7 @@"auth.login.authentik": "Accedi con Authentik","auth.login.azure": "Accedi con Microsoft","auth.login.bitbucket": "Accedi con Bitbucket",+ "auth.login.clerk": "Accedi con Clerk","auth.login.discord": "Accedi con Discord","auth.login.github": "Accedi con GitHub","auth.login.gitlab": "Accedi con Gitlab",diff --git a/lang/ja.json b/lang/ja.jsonindex 7afdb05c1e..87d87d99be 100644--- a/lang/ja.json+++ b/lang/ja.json@@ -2,6 +2,7 @@"auth.login": "ログイン","auth.login.azure": "Microsoftでログイン","auth.login.bitbucket": "Bitbucketでログイン",+ "auth.login.clerk": "Clerkでログイン","auth.login.discord": "Discordでログイン","auth.login.github": "GitHubでログイン","auth.login.gitlab": "Gitlabでログイン",diff --git a/lang/no.json b/lang/no.jsonindex fa3693f5fa..a84f6aa6c4 100644--- a/lang/no.json+++ b/lang/no.json@@ -3,6 +3,7 @@"auth.login.authentik": "Logg inn med Authentik","auth.login.azure": "Logg inn med Microsoft","auth.login.bitbucket": "Logg inn med Bitbucket",+ "auth.login.clerk": "Logg inn med Clerk","auth.login.discord": "Logg inn med Discord","auth.login.github": "Logg inn med GitHub","auth.login.gitlab": "Logg inn med Gitlab",diff --git a/lang/pt-br.json b/lang/pt-br.jsonindex efd97c4966..c3a1029957 100644--- a/lang/pt-br.json+++ b/lang/pt-br.json@@ -3,6 +3,7 @@"auth.login.authentik": "Entrar com Authentik","auth.login.azure": "Entrar com Microsoft","auth.login.bitbucket": "Entrar com Bitbucket",+ "auth.login.clerk": "Entrar com Clerk","auth.login.discord": "Entrar com Discord","auth.login.github": "Entrar com GitHub","auth.login.gitlab": "Entrar com Gitlab",diff --git a/lang/pt.json b/lang/pt.jsonindex d39390f7f1..80ff8c1468 100644--- a/lang/pt.json+++ b/lang/pt.json@@ -2,6 +2,7 @@"auth.login": "Entrar","auth.login.azure": "Entrar com Microsoft","auth.login.bitbucket": "Entrar com Bitbucket",+ "auth.login.clerk": "Entrar com Clerk","auth.login.discord": "Entrar com Discord","auth.login.github": "Entrar com GitHub","auth.login.gitlab": "Entrar com Gitlab",diff --git a/lang/ro.json b/lang/ro.jsonindex 499c5d60f3..5588ea6f48 100644--- a/lang/ro.json+++ b/lang/ro.json@@ -2,6 +2,7 @@"auth.login": "Autentificare","auth.login.azure": "Autentificare prin Microsoft","auth.login.bitbucket": "Autentificare prin Bitbucket",+ "auth.login.clerk": "Autentificare prin Clerk","auth.login.discord": "Autentificare prin Discord","auth.login.github": "Autentificare prin GitHub","auth.login.gitlab": "Autentificare prin Gitlab",diff --git a/lang/tr.json b/lang/tr.jsonindex ef9ad216a0..74f693dc9c 100644--- a/lang/tr.json+++ b/lang/tr.json@@ -2,6 +2,7 @@"auth.login": "Giriş","auth.login.azure": "Microsoft ile Giriş Yap","auth.login.bitbucket": "Bitbucket ile Giriş Yap",+ "auth.login.clerk": "Clerk ile Giriş Yap","auth.login.discord": "Discord ile Giriş Yap","auth.login.github": "GitHub ile Giriş Yap","auth.login.gitlab": "GitLab ile Giriş Yap",diff --git a/lang/vi.json b/lang/vi.jsonindex 050ef337f1..46edac5998 100644--- a/lang/vi.json+++ b/lang/vi.json@@ -2,6 +2,7 @@"auth.login": "Đăng Nhập","auth.login.azure": "Đăng Nhập Bằng Microsoft","auth.login.bitbucket": "Đăng Nhập Bằng Bitbucket",+ "auth.login.clerk": "Đăng Nhập Bằng Clerk","auth.login.discord": "Đăng Nhập Bằng Discord","auth.login.github": "Đăng Nhập Bằng GitHub","auth.login.gitlab": "Đăng Nhập Bằng Gitlab",diff --git a/lang/zh-cn.json b/lang/zh-cn.jsonindex 7908b53ee0..d46c71e071 100644--- a/lang/zh-cn.json+++ b/lang/zh-cn.json@@ -2,6 +2,7 @@"auth.login": "登录","auth.login.azure": "使用 Microsoft 登录","auth.login.bitbucket": "使用 Bitbucket 登录",+ "auth.login.clerk": "使用 Clerk 登录","auth.login.discord": "使用 Discord 登录","auth.login.github": "使用 GitHub 登录","auth.login.gitlab": "使用 Gitlab 登录",diff --git a/lang/zh-tw.json b/lang/zh-tw.jsonindex 4706808248..c0784c7b73 100644--- a/lang/zh-tw.json+++ b/lang/zh-tw.json@@ -2,6 +2,7 @@"auth.login": "登入","auth.login.azure": "使用 Microsoft 登入","auth.login.bitbucket": "使用 Bitbucket 登入",+ "auth.login.clerk": "使用 Clerk 登入","auth.login.discord": "使用 Discord 登入","auth.login.github": "使用 GitHub 登入","auth.login.gitlab": "使用 Gitlab 登入",diff --git a/resources/views/livewire/settings-oauth.blade.php b/resources/views/livewire/settings-oauth.blade.phpindex 76d03dc14a..f559f57ac6 100644--- a/resources/views/livewire/settings-oauth.blade.php+++ b/resources/views/livewire/settings-oauth.blade.php@@ -37,7 +37,7 @@helper="Optional parameter that supplies a hosted domain (HD) to Google, which<br>triggers a login hint to be displayed on the OAuth screen with this domain.<br><br><a class='underline dark:text-warning text-coollabs' href='https://developers.google.com/identity/openid-connect/openid-connect#hd-param' target='_blank'>Google Documentation</a>"label="Tenant" />@endif- @if ($oauth_setting->provider == 'authentik')+ @if ($oauth_setting->provider == 'authentik' || $oauth_setting->provider == 'clerk')<x-forms.input id="oauth_settings_map.{{ $oauth_setting->provider }}.base_url"label="Base URL" />@endif