إعداد تسجيل الدخول عبر Discord ل Discourse

:bookmark: This guide explains how to set up and configure Discord as a login option for your Discourse forum, including how to restrict access to specific Discord guilds.

:person_raising_hand: Required user level: Administrator

Once configured, Discord will appear as a login option alongside other authentication methods on your forum:

Setting up Discord OAuth2

Creating a Discord application

  1. Visit the Discord developer portal
  2. Click “New Application”
  3. Enter a name, upload an icon, and add a description for your application
    • These details will be shown to users during the login process

Configuring OAuth2 settings

  1. Navigate to the “OAuth2” tab in the left sidebar

  1. Copy the “Client ID” and “Client Secret”
    • If the secret isn’t visible, click “Reset Secret” to generate a new one
  2. Add your redirect URL:
    • Format: https://your-discourse-site.com/auth/discord/callback
    • :warning: Do not include a trailing slash
  3. Click “Save Changes”

Enabling Discord login in Discourse

  1. In your Discourse admin settings, enter the Client ID in the discord_client_id setting
  2. Enter the Client Secret in the discord_client_secret setting
  3. Enable the enable_discord_logins setting

Restricting access to specific Discord guilds

You can limit Discord login to members of specific Discord guilds (servers).

Finding your guild ID

  1. Open Discord in your browser
  2. Navigate to any channel in your guild
  3. Look at the URL: https://discordapp.com/channels/{guild_id}/{channel_id}
  4. Copy the first number (guild_id) from the URL
    • Example: In https://discordapp.com/channels/123/456, the guild ID is 123

Configuring guild restrictions

  1. In your Discourse admin settings, locate the discord_trusted_guilds setting
  2. Add your guild ID(s)
    • You can add multiple guild IDs if needed

When guild restriction is enabled:

  • Members of trusted guilds will log in normally
  • Other users will see an error message
  • You can customize this message under Customize → Text, search for discord.not_in_allowed_guild

:warning: If you’re using guild restrictions for security, disable all other login methods in your Discourse settings.

Next steps

Consider setting up the chat-integration plugin to push important Discourse topics to your Discord channels.

Last edited by @jessii 2024-12-11T19:59:00Z

Check documentPerform check on document:
33 إعجابًا

تم تقسيم مشاركة إلى موضوع جديد: إضافة المزيد من النطاقات لتسجيل الدخول إلى Discord

ألا تبدأ معرفات القنوات على ديسكورد الآن بـ discord.com؟ عندما أستخدم ديسكورد على الويب، كانت دائمًا discord.com/channels/[guild_id]/[channel_id] على مدار العامين الماضيين أو نحو ذلك.

يبدو أن هذا الدليل قديم جدًا. في واجهة مسؤول Discourse، يمكنك تحديد:

  • تمكين تسجيلات الدخول إلى Discord
  • معرف عميل Discord
  • سر Discord
  • النقابات الموثوقة في Discord (اختياري)

في هذه الأثناء، في واجهة مطوري Discord، لدينا:

  • الاسم
  • الوصف (اختياري)
  • معرف التطبيق
  • المفتاح العام
  • عنوان URL لنقطة نهاية التفاعلات (اختياري)
  • عنوان URL للتحقق من الأدوار المرتبطة (اختياري)

بافتراض أن

  • معرف عميل Discord هو معرف التطبيق، و
  • سر Discord هو نفس المفتاح العام، و
  • ترك الخيارات الاختيارية فارغة،

ينتج عن هذا خطأ في Discord أثناء محاولة المصادقة:

إذا حاولت تعيين عنوان URL لنقطة نهاية التفاعلات إلى
https://forum.example.com/auth/discord/callback، أحصل على

أخطاء التحقق:
    interactions_endpoint_url: لم يمكن التحقق من عنوان URL لنقطة نهاية التفاعلات المحدد.

في واجهة مطوري Discord.

ما هو الإجراء الصحيح لإعداد هذا؟