Skip to content

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.

feat(auth): Add Discord OAuth Provider (#5552)

Yassir Elmarissi4375f52c5d7d
diff --git a/.cursor/rules/security-patterns.mdc b/.cursor/rules/security-patterns.mdc
index d47d033752..85c48c035c 100644
--- a/.cursor/rules/security-patterns.mdc
+++ b/.cursor/rules/security-patterns.mdc
@@ -22,6 +22,7 @@ Coolify implements **defense-in-depth security** with multiple layers of protect
- Google OAuth
- Microsoft Azure AD
- Authentik
+ - Discord
- GitHub (via GitHub Apps)
- GitLab
diff --git a/.cursor/rules/technology-stack.mdc b/.cursor/rules/technology-stack.mdc
index 1e894720c0..3082b9c3e2 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
+ - Microsoft Azure, Authentik, Discord
- Custom OAuth implementations
## Background Processing
diff --git a/app/Livewire/Server/Security/Patches.php b/app/Livewire/Server/Security/Patches.php
index 9392fc3514..b7d17a61dc 100644
--- a/app/Livewire/Server/Security/Patches.php
+++ b/app/Livewire/Server/Security/Patches.php
@@ -69,6 +69,7 @@ class Patches extends Component
{
if (! $this->packageManager || ! $this->osId) {
$this->dispatch('error', message: 'Run “Check for updates” first.');
+
return;
}
diff --git a/app/Livewire/Subscription/Index.php b/app/Livewire/Subscription/Index.php
index 8a9cc456fe..ac37cca054 100644
--- a/app/Livewire/Subscription/Index.php
+++ b/app/Livewire/Subscription/Index.php
@@ -75,7 +75,7 @@ class Index extends Component
}
} catch (\Exception $e) {
// Log the error
- logger()->error('Stripe API error: ' . $e->getMessage());
+ logger()->error('Stripe API error: '.$e->getMessage());
// Set a flag to show an error message to the user
$this->addError('stripe', 'Could not retrieve subscription information. Please try again later.');
} finally {
diff --git a/app/Providers/EventServiceProvider.php b/app/Providers/EventServiceProvider.php
index b960dd8e3c..0678100df4 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\Discord\DiscordExtendSocialite;
use SocialiteProviders\Google\GoogleExtendSocialite;
use SocialiteProviders\Infomaniak\InfomaniakExtendSocialite;
use SocialiteProviders\Manager\SocialiteWasCalled;
@@ -25,6 +26,7 @@ class EventServiceProvider extends ServiceProvider
SocialiteWasCalled::class => [
AzureExtendSocialite::class.'@handle',
AuthentikExtendSocialite::class.'@handle',
+ DiscordExtendSocialite::class.'@handle',
GoogleExtendSocialite::class.'@handle',
InfomaniakExtendSocialite::class.'@handle',
],
diff --git a/bootstrap/helpers/socialite.php b/bootstrap/helpers/socialite.php
index fe19752cba..2ed1ed1c34 100644
--- a/bootstrap/helpers/socialite.php
+++ b/bootstrap/helpers/socialite.php
@@ -53,6 +53,7 @@ function get_socialite_provider(string $provider)
$provider_class_map = [
'bitbucket' => \Laravel\Socialite\Two\BitbucketProvider::class,
+ 'discord' => \SocialiteProviders\Discord\Provider::class,
'github' => \Laravel\Socialite\Two\GithubProvider::class,
'gitlab' => \Laravel\Socialite\Two\GitlabProvider::class,
'infomaniak' => \SocialiteProviders\Infomaniak\Provider::class,
diff --git a/composer.json b/composer.json
index 3fb1206cee..2495dc1c81 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/discord": "^4.2",
"socialiteproviders/google": "^4.1",
"socialiteproviders/infomaniak": "^4.0",
"socialiteproviders/microsoft-azure": "^5.2",
diff --git a/composer.lock b/composer.lock
index 14ae57fcbb..5794ac4822 100644
--- a/composer.lock
+++ b/composer.lock
@@ -7482,6 +7482,56 @@
},
"time": "2023-11-07T22:21:16+00:00"
},
+ {
+ "name": "socialiteproviders/discord",
+ "version": "4.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/SocialiteProviders/Discord.git",
+ "reference": "c71c379acfdca5ba4aa65a3db5ae5222852a919c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/SocialiteProviders/Discord/zipball/c71c379acfdca5ba4aa65a3db5ae5222852a919c",
+ "reference": "c71c379acfdca5ba4aa65a3db5ae5222852a919c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-json": "*",
+ "php": "^7.4 || ^8.0",
+ "socialiteproviders/manager": "~4.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "SocialiteProviders\\Discord\\": ""
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Christopher Eklund",
+ "email": "[email protected]"
+ }
+ ],
+ "description": "Discord OAuth2 Provider for Laravel Socialite",
+ "keywords": [
+ "discord",
+ "laravel",
+ "oauth",
+ "provider",
+ "socialite"
+ ],
+ "support": {
+ "docs": "https://socialiteproviders.com/discord",
+ "issues": "https://github.com/socialiteproviders/providers/issues",
+ "source": "https://github.com/socialiteproviders/providers"
+ },
+ "time": "2023-07-24T23:28:47+00:00"
+ },
{
"name": "socialiteproviders/google",
"version": "4.1.0",
diff --git a/database/seeders/OauthSettingSeeder.php b/database/seeders/OauthSettingSeeder.php
index fa692d2dc6..9adcb04d4c 100644
--- a/database/seeders/OauthSettingSeeder.php
+++ b/database/seeders/OauthSettingSeeder.php
@@ -17,6 +17,7 @@ class OauthSettingSeeder extends Seeder
$providers = collect([
'azure',
'bitbucket',
+ 'discord',
'github',
'gitlab',
'google',
diff --git a/lang/ar.json b/lang/ar.json
index 9befd1e4a1..3a0e32fc37 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.discord": "تسجيل الدخول باستخدام Discord",
"auth.login.github": "تسجيل الدخول باستخدام GitHub",
"auth.login.gitlab": "تسجيل الدخول باستخدام Gitlab",
"auth.login.google": "تسجيل الدخول باستخدام Google",
diff --git a/lang/az.json b/lang/az.json
index 973c70c2f1..4bd437f6ac 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.discord": "Discord ilə daxil ol",
"auth.login.github": "Github ilə daxil ol",
"auth.login.gitlab": "GitLab ilə daxil ol",
"auth.login.google": "Google ilə daxil ol",
diff --git a/lang/cs.json b/lang/cs.json
index 270fd272ba..83f7c3c556 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.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",
"auth.login.google": "Přihlásit se pomocí Google",
diff --git a/lang/de.json b/lang/de.json
index c5644e3a7a..8388a2b087 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.discord": "Mit Discord anmelden",
"auth.login.github": "Mit GitHub anmelden",
"auth.login.gitlab": "Mit GitLab anmelden",
"auth.login.google": "Mit Google anmelden",
diff --git a/lang/en.json b/lang/en.json
index cdca686013..d127de5a95 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.discord": "Login with Discord",
"auth.login.github": "Login with GitHub",
"auth.login.gitlab": "Login with Gitlab",
"auth.login.google": "Login with Google",
diff --git a/lang/es.json b/lang/es.json
index aceacd4625..fde5b88051 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.discord": "Acceder con Discord",
"auth.login.github": "Acceder con GitHub",
"auth.login.gitlab": "Acceder con Gitlab",
"auth.login.google": "Acceder con Google",
diff --git a/lang/fa.json b/lang/fa.json
index 7a714e6266..48d7facc3e 100644
--- a/lang/fa.json
+++ b/lang/fa.json
@@ -2,6 +2,7 @@
"auth.login": "ورود",
"auth.login.azure": "ورود با مایکروسافت",
"auth.login.bitbucket": "ورود با Bitbucket",
+ "auth.login.discord": "ورود با Discord",
"auth.login.github": "ورود با گیت هاب",
"auth.login.gitlab": "ورود با گیت لب",
"auth.login.google": "ورود با گوگل",
diff --git a/lang/fr.json b/lang/fr.json
index 68763d5e00..ef2b26b9ba 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.discord": "Connexion avec Discord",
"auth.login.github": "Connexion avec GitHub",
"auth.login.gitlab": "Connexion avec Gitlab",
"auth.login.google": "Connexion avec Google",
diff --git a/lang/id.json b/lang/id.json
index d355564020..c77d656793 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.discord": "Masuk dengan Discord",
"auth.login.github": "Masuk dengan GitHub",
"auth.login.gitlab": "Masuk dengan Gitlab",
"auth.login.google": "Masuk dengan Google",
diff --git a/lang/it.json b/lang/it.json
index 1923251a5e..f867d26965 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.discord": "Accedi con Discord",
"auth.login.github": "Accedi con GitHub",
"auth.login.gitlab": "Accedi con Gitlab",
"auth.login.google": "Accedi con Google",
diff --git a/lang/ja.json b/lang/ja.json
index 4d45899001..7afdb05c1e 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.discord": "Discordでログイン",
"auth.login.github": "GitHubでログイン",
"auth.login.gitlab": "Gitlabでログイン",
"auth.login.google": "Googleでログイン",
diff --git a/lang/no.json b/lang/no.json
index 29d5af1247..fa3693f5fa 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.discord": "Logg inn med Discord",
"auth.login.github": "Logg inn med GitHub",
"auth.login.gitlab": "Logg inn med Gitlab",
"auth.login.google": "Logg inn med Google",
diff --git a/lang/pt-br.json b/lang/pt-br.json
index 2e793890f2..efd97c4966 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.discord": "Entrar com Discord",
"auth.login.github": "Entrar com GitHub",
"auth.login.gitlab": "Entrar com Gitlab",
"auth.login.google": "Entrar com Google",
diff --git a/lang/pt.json b/lang/pt.json
index c5f393e65c..d39390f7f1 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.discord": "Entrar com Discord",
"auth.login.github": "Entrar com GitHub",
"auth.login.gitlab": "Entrar com Gitlab",
"auth.login.google": "Entrar com Google",
diff --git a/lang/ro.json b/lang/ro.json
index 4c7968cfa2..499c5d60f3 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.discord": "Autentificare prin Discord",
"auth.login.github": "Autentificare prin GitHub",
"auth.login.gitlab": "Autentificare prin Gitlab",
"auth.login.google": "Autentificare prin Google",
diff --git a/lang/tr.json b/lang/tr.json
index 663c756f9a..ef9ad216a0 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.discord": "Discord ile Giriş Yap",
"auth.login.github": "GitHub ile Giriş Yap",
"auth.login.gitlab": "GitLab ile Giriş Yap",
"auth.login.google": "Google ile Giriş Yap",
diff --git a/lang/vi.json b/lang/vi.json
index bb43fd34d4..050ef337f1 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.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",
"auth.login.google": "Đăng Nhập Bằng Google",
diff --git a/lang/zh-cn.json b/lang/zh-cn.json
index 944887a5fc..7908b53ee0 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.discord": "使用 Discord 登录",
"auth.login.github": "使用 GitHub 登录",
"auth.login.gitlab": "使用 Gitlab 登录",
"auth.login.google": "使用 Google 登录",
diff --git a/lang/zh-tw.json b/lang/zh-tw.json
index c42ebb33e3..4706808248 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.discord": "使用 Discord 登入",
"auth.login.github": "使用 GitHub 登入",
"auth.login.gitlab": "使用 Gitlab 登入",
"auth.login.google": "使用 Google 登入",