إعداد DiscourseConnect - تسجيل الدخول الموحد الرسمي لـ Discourse (sso)

يُعد DiscourseConnect ميزة أساسية في Discourse تتيح لك تكوين “تسجيل الدخول الموحد (SSO)” لتفويض جميع عمليات تسجيل الدخول وتسجيل المستخدمين من Discourse بالكامل إلى موقع آخر. متوفر لعملائنا في خطط الاستضافة الاحترافية، التجارية، والمؤسسية.

:information_source: (فبراير 2021) تم تغيير اسم “Discourse SSO” إلى “DiscourseConnect”. إذا كنت تشغل إصدارًا قديمًا من Discourse، فستُسمى الإعدادات أدناه sso_... بدلاً من discourse_connect_...

المشكلة

تود العديد من المواقع التي ترغب في التكامل مع موقع Discourse الاحتفاظ بجميع عمليات تسجيل المستخدمين في موقع منفصل. في مثل هذا الإعداد، يجب تفويض جميع عمليات تسجيل الدخول إلى ذلك الموقع الآخر.

ماذا لو أردت استخدام SSO بالتزامن مع مصادقة موجودة؟

الهدف من DiscourseConnect هو استبدال مصادقة Discourse. إذا كنت ترغب في إضافة مزود جديد، فراجع الإضافات الموجودة مثل: Discourse VK Authentication (vkontakte)

تمكين DiscourseConnect

لتمكين DiscourseConnect، يجب عليك ملء ثلاث إعدادات:

enable_discourse_connect: يجب تمكينه، وهو مفتاح عام.
discourse_connect_url: عنوان URL خارجي سيتم توجيه المستخدمين إليه عند محاولة تسجيل الدخول.
discourse_connect_secret: سلسلة سرية تُستخدم لتجزئة حمولات SSO. تضمن أصالة الحمولات.

بمجرد تعيين enable_discourse_connect إلى true:

  • عند النقر على تسجيل الدخول أو الصورة الرمزية، سيتم إعادة توجيهك إلى /session/sso، والذي بدوره سيعيد توجيه المستخدمين إلى discourse_connect_url مع حمولة موقعة.
  • لن يُسمح للمستخدمين بـ “تغيير كلمة المرور”. يتم إزالة هذا الحقل من ملف المستخدم.
  • لن يتمكن المستخدمون بعد الآن من استخدام مصادقة Discourse (اسم المستخدم/كلمة المرور، Google، إلخ).

ماذا لو قمت بتفعيله بالخطأ؟

راجع: Log back in as admin after locking yourself out with read-only mode or an invalid SSO configuration

تنفيذ DiscourseConnect على موقعك

:warning: يستخدم Discourse عناوين البريد الإلكتروني لربط المستخدمين الخارجيين بمستخدمي Discourse، ويفترض أن عناوين البريد الإلكتروني الخارجية آمنة. إِذَا لَمْ تُعَزِّزَ صِحَّةَ عَوَازِلِ الْبَرِيدِ الْإِلِكْتُرُونِيِّ قَبْلَ إِرسالِهَا إِلَى DISCOURSE، فَموقعُكَ سَيَكُونُ شَدِيدَ الضَّعْفِ!

بدلاً من ذلك، إذا كنت مصراً على إرسال عناوين بريد إلكتروني غير معززة، تأكد من تعيين require_activation=true. هذا سيجبر جميع عناوين البريد الإلكتروني على التحقق من صحتها بواسطة Discourse. نُنصح بشدة بعدم القيام بذلك، لذا إذا واصلت معتمدين على هذا الإعداد، فإنك تتحمل مخاطر كبيرة.

سيقوم Discourse بإعادة توجيه العملاء إلى discourse_connect_url مع حمولة موقعة: (لنفترض أن discourse_connect_url هو https://somesite.com/sso)

ستستقبل حركة مرور واردة على النحو التالي:

https://somesite.com/sso?sso=PAYLOAD&sig=SIG

الحمولة هي سلسلة مشفرة بـ Base64 تتكون من nonce و return_sso_url. الحمولة هي دائمًا سلسلة استعلام صالحة.

على سبيل المثال، إذا كان الـ nonce هو ABCD، فسيكون raw_payload كالتالي:

nonce=ABCD&return_sso_url=https%3A%2F%2Fdiscourse_site%2Fsession%2Fsso_login، ويتم تشفير هذه الحمولة الخام بـ base 64.

يجب أن يقوم نقطة النهاية المستدعاة بما يلي:

  1. التحقق من صحة التوقيع: تأكد من أن HMAC-SHA256 الخاص بـ PAYLOAD (باستخدام discourse_connect_secret كمفتاح) يساوي sig (سيكون sig مشفرًا بصيغة سداسية عشرية).
  2. تنفيذ أي مصادقة مطلوبة.
  3. إنشاء حمولة جديدة مشفرة بـ URL تحتوي على الأقل على nonce و email و external_id. يمكنك أيضًا تقديم بعض البيانات الإضافية، إليك قائمة بجميع المفاتيح التي سيفهمها Discourse:
    • يجب نسخ nonce من حمولة الإدخال.
    • يجب أن يكون email عنوان بريد إلكتروني معتمدًا. إذا لم يتم التحقق من عنوان البريد الإلكتروني، فقم بتعيين require_activation إلى “true”.
    • external_id هو أي سلسلة فريدة للمستخدم لن تتغير أبدًا، حتى لو تغير بريدُه الإلكتروني أو اسمه أو غيره. القيمة المقترحة هي رقم الصف ‘id’ في قاعدة بياناتك.
    • سيصبح username اسم المستخدم في Discourse إذا كان المستخدم جديدًا أو إذا تم تعيين SiteSetting.auth_overrides_username.
    • سيصبح name الاسم الكامل في Discourse إذا كان المستخدم جديدًا أو إذا تم تعيين SiteSetting.auth_overrides_name.
    • سيتم تحميل avatar_url وتعيينه كصورة رمزية للمستخدم إذا كان المستخدم جديدًا أو إذا تم تعيين SiteSetting.discourse_connect_overrides_avatar.
    • avatar_force_update هو حقل منطقي (boolean). إذا تم تعيينه إلى true، فسيفرض على Discourse تحديث الصورة الرمزية للمستخدم، سواء تغيرت avatar_url أم لا.
    • سيصبح bio محتوى السيرة الذاتية للمستخدم إذا كان المستخدم جديدًا، أو كانت سيرته الذاتية فارغة، أو تم تعيين SiteSetting.discourse_connect_overrides_bio.
    • سيُعد title لقب المستخدم.
    • سيُعد website موقع المستخدم في ملفه الشخصي.
    • سيُعد location موقع المستخدم في ملفه الشخصي.
    • سيتم تحميل profile_background_url وتعيينه كخلفية ملف المستخدم إذا كان المستخدم جديدًا أو إذا تم تعيين SiteSetting.discourse_connect_overrides_profile_background.
    • سيتم تحميل card_background_url وتعيينه كخلفية بطاقة المستخدم إذا كان المستخدم جديدًا أو إذا تم تعيين SiteSetting.discourse_connect_overrides_card_background.
    • سيُعد locale لغة المستخدم إذا كان المستخدم جديدًا وتم تمكين SiteSetting.allow_user_locale.
    • locale_force_update هو حقل منطقي. إذا تم تعيينه إلى true مع locale، فسيُجبر على تحديث اللغة للمستخدمين الحاليين (يتطلب SiteSetting.allow_user_locale).
    • الحقول المنطقية الإضافية (“true” أو “false”) هي: admin، moderator، suppress_welcome_message، logout.
  4. قم بتشفير الحمولة بـ Base64.
  5. احسب تجزئة HMAC-SHA256 للحمولة باستخدام discourse_connect_secret كمفتاح والحمولة المشفرة بـ Base64 كنص.
  6. أعد التوجيه إلى return_sso_url مع معلمتي استعلام sso و sig (http://discourse_site/session/sso_login?sso=payload&sig=sig).

سيقوم Discourse بالتحقق من صحة الـ nonce، وإذا كان صالحًا، فسيستنفده فورًا حتى لا يمكن استخدامه مرة أخرى. ثم سيحاول:

  1. تسجيل دخول المستخدم عن طريق البحث عن external_id مرتبط بالفعل في نموذج SingleSignOnRecord.
  2. تسجيل دخول المستخدم باستخدام البريد الإلكتروني المقدم (تحديث external_id) (ما لم يكن require_activation = true).
  3. إنشاء حساب جديد للمستخدم مع تقديم (البريد الإلكتروني، اسم المستخدم، الاسم) وتحديث external_id.

مخاوف أمنية

سيستنفد الـ nonce (الرمز لمرة واحدة) تلقائيًا بعد 30 دقيقة. هذا يعني أنه بمجرد إعادة توجيه المستخدم إلى موقعك، يكون لديه 30 دقيقة لتسجيل الدخول أو إنشاء حساب جديد.

البروتوكول آمن ضد هجمات إعادة التشغيل لأن الـ nonce يمكن استخدامه مرة واحدة فقط. يرتبط الـ nonce بجلسة المتصفح الحالية للحماية من هجمات CSRF.

تحديد عضوية المجموعات

إذا تم تحديد خيار discourse connect overrides groups، فسينظر Discourse في القائمة المفصولة بفواصل للمجموعات الممررة في groups.

بالإضافة إلى groups، يمكنك أيضًا تحديد عضوية المجموعات في حمولة SSO الخاصة بك باستخدام سمات add_groups و remove_groups بغض النظر عن خيار discourse connect overrides groups.

add_groups هي قائمة مفصولة بفواصل لأسماء المجموعات التي سنضمن أن المستخدم عضو فيها.
remove_groups هي قائمة مفصولة بفواصل لأسماء المجموعات التي سنضمن أن المستخدم ليس عضوًا فيها.

تنفيذ مرجعي

يحتوي Discourse على تنفيذ مرجعي لفئة SSO:

سيكون التنفيذ التافه كالتالي:

class DiscourseSsoController < ApplicationController
  def sso
    secret = "MY_SECRET_STRING"
    sso = DiscourseApi::SingleSignOn.parse(request.query_string, secret)
    sso.email = "user@email.com"
    sso.name = "Bill Hicks"
    sso.username = "bill@hicks.com"
    sso.external_id = "123" # معرف فريد لكل مستخدم في تطبيقك
    sso.sso_secret = secret

    redirect_to sso.to_url("http://l.discourse/session/sso_login")
  end
end

الانتقال إلى تسجيل الدخول الموحد منه.

طالما لم يتم تعيين معامل require_activation إلى true في حمولة الطلب، فإن النظام يثق في عناوين البريد الإلكتروني المقدمة من نقطة نهاية تسجيل الدخول الموحد. هذا يعني أنه إذا كان لديك حساب موجود سابقًا في Discourse مع تعطيل DiscourseConnect، فسيقوم DiscourseConnect بإعادة استخدامه ببساطة وتجنب إنشاء حساب جديد.

إذا قمت بإيقاف تشغيل DiscourseConnect، فسيتمكن المستخدمون من إعادة تعيين كلمات المرور والحصول على الوصول إلى حساباتهم مرة أخرى.

مثال من العالم الحقيقي:

بافتراض الإعدادات التالية:

نطاق Discourse: http://discuss.example.com
عنوان URL الخاص بـ DiscourseConnect: http://www.example.com/discourse/sso
سر DiscourseConnect: d836444a9e4084d5b224a60c208dce14
تم التحقق من البريد الإلكتروني: لا (أضف require_activation=true إلى الحمولة)

محاولة مستخدم لتسجيل الدخول

  • يتم إنشاء الـ nonce: cb68251eefb5211e58c00ff1395f0c0b

  • يتم إنشاء الحمولة الخام: nonce=cb68251eefb5211e58c00ff1395f0c0b

  • يتم تشفير الحمولة بـ Base64: bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGI=

  • يتم تشفير الحمولة بـ URL: bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGI%3D

  • يتم إنشاء HMAC-SHA256 على الحمولة المشفرة بـ Base64: 1ce1494f94484b6f6a092be9b15ccc1cdafb1f8460a3838fbb0e0883c4390471

أخيرًا، يتم إعادة توجيه المتصفح إلى:

http://www.example.com/discourse/sso?sso=bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGI%3D&sig=1ce1494f94484b6f6a092be9b15ccc1cdafb1f8460a3838fbb0e0883c4390471

في الطرف الآخر

  1. يتم التحقق من الحمولة باستخدام HMAC-SHA256، إذا لم يتطابق التوقيع، تتوقف العملية.
  2. عن طريق عكس الخطوات المذكورة أعلاه، يتم استخراج الـ nonce.

تسجيل دخول المستخدم:

name: sam
external_id: hello123
email: test@test.com
username: samsam
require_activation: true

يتم إنشاء حمولة غير موقعة:

nonce=cb68251eefb5211e58c00ff1395f0c0b&name=sam&username=samsam&email=test%40test.com&external_id=hello123&require_activation=true

الترتيب لا يهم، القيم مشفرة بـ URL

يتم تشفير الحمولة بـ Base64

bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGImbmFtZT1zYW0mdXNlcm5hbWU9c2Ftc2FtJmVtYWlsPXRlc3QlNDB0ZXN0LmNvbSZleHRlcm5hbF9pZD1oZWxsbzEyMyZyZXF1aXJlX2FjdGl2YXRpb249dHJ1ZQ==

يتم تشفير الحمولة بـ URL

bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGImbmFtZT1zYW0mdXNlcm5hbWU9c2Ftc2FtJmVtYWlsPXRlc3QlNDB0ZXN0LmNvbSZleHRlcm5hbF9pZD1oZWxsbzEyMyZyZXF1aXJlX2FjdGl2YXRpb249dHJ1ZQ%3D%3D

يتم توقيع الحمولة المشفرة بـ Base64

3d7e5ac755a87ae3ccf90272644ed2207984db03cf020377c8b92ff51be3abc3

يعيد المتصفح التوجيه إلى:

http://discuss.example.com/session/sso_login?sso=bm9uY2U9Y2I2ODI1MWVlZmI1MjExZTU4YzAwZmYxMzk1ZjBjMGImbmFtZT1zYW0mdXNlcm5hbWU9c2Ftc2FtJmVtYWlsPXRlc3QlNDB0ZXN0LmNvbSZleHRlcm5hbF9pZD1oZWxsbzEyMyZyZXF1aXJlX2FjdGl2YXRpb249dHJ1ZQ%3D%3D&sig=3d7e5ac755a87ae3ccf90272644ed2207984db03cf020377c8b92ff51be3abc3

مزامنة سجلات DiscourseConnect

يمكنك استخدام نقطة نهاية الإدارة POST /admin/users/sync_sso لمزامنة سجل DiscourseConnect، وتمرير نفس السجل الذي ستمرره إلى نقطة نهاية DiscourseConnect، ولا يهم الـ nonce.

إذا قمت باستدعاء admin/users/sync_sso من موقع آخر، فستحتاج إلى تضمين api_key إداري صالح و api_username صالح في رؤوس الطلب. راجع Sync DiscourseConnect user data with the sync_sso route لمزيد من التفاصيل حول كيفية هيكلة الطلب.

مسح سجلات DiscourseConnect

إذا تغيرت قيم external_id الخاصة بك من مزود DiscourseConnect (ربما قمت بتغيير خوارزمية التوليد، أو ربما هي نقطة نهاية مختلفة)، فيمكنك إزالة جميع السجلات الموجودة بأمان باستخدام وحدة تحكم rails:

SingleSignOnRecord.destroy_all

تسجيل خروج المستخدمين

يمكنك استخدام نقطة نهاية الإدارة POST /admin/users/{USER_ID}/log_out لتسجيل خروج أي مستخدم في النظام عند الحاجة.

لتكوين نقطة النهاية التي يعيد توجيه Discourse إليها عند تسجيل الخروج، ابحث عن إعداد logout redirect. إذا لم يتم تعيين أي عنوان URL هنا، فسيتم إعادة توجيهك إلى العنوان المكون في discourse connect url.

البحث عن المستخدمين حسب external_id

يمكن الوصول إلى بيانات ملف المستخدم باستخدام نقطة النهاية /users/by-external/{EXTERNAL_ID}.json. سيعيد هذا حمولة JSON تحتوي على معلومات المستخدم، بما في ذلك user_id الذي يمكن استخدامه مع نقطة نهاية log_out.

تنفيذات موجودة

  • يمكن استخدام مكتبة discourse_api لـ SSO. راجع كود SSO في مجلد الأمثلة لرؤية تنفيذ أساسي.

  • يجعل إضافة WordPress الخاصة بنا من السهل تكوين SSO بين WordPress و Discourse. توجد تفاصيل حول إعداده في علامة التبويب SSO في صفحة خيارات الإضافة.

عمل مستقبلي

  • نود جمع المزيد من التنفيذات المرجعية لـ SSO على منصات أخرى. إذا كان لديك واحد، فيرجى النشر في فئة Dev / SSO.

ميزات متقدمة

  • يمكنك تمرير حقول مخصصة للمستخدمين عن طريق إضافة بادئة custom لاسم الحقل. على سبيل المثال، يمكن استخدام custom.user_field_1 لتعيين قيمة UserCustomField التي تحمل الاسم user_field_1.
  • يمكنك تمرير avatar_url لتجاوز الصورة الرمزية للمستخدم (يجب تمكين SiteSetting.discourse_connect_overrides_avatar). يتم تخزين الصور الرمزية مؤقتًا، لذا مرر avatar_force_update=true لإجبارها على التحديث إذا كان العنوان هو نفسه. حاليًا، لا يمكنك تمرير عنوان URL فارغ لتعطيل صورة المستخدم الرمزية.
  • بشكل افتراضي، سيتم إرسال رسالة الترحيب إلى جميع المستخدمين الجدد المُنشأين عبر SSO. إذا كنت ترغب في قمع ذلك، فيمكنك تمرير suppress_welcome_message=true.
  • لتكوين مثيل Discourse الخاص بك كمزود Discourse Connect، راجع: استخدام DiscourseConnect كمزود هوية.

تصحيح مشكلة مزود DiscourseConnect الخاص بك

لمساعدة في تصحيح مشكلة DiscourseConnect، يمكنك تمكين إعداد الموقع verbose_discourse_connect_logging. بتمكين هذا الإعداد، ستظهر تشخيصات غنية في YOURSITE.com/logs. تأكد من تحديد مربع :white_check_mark: warnings في أسفل YOURSITE.com/logs.

سنسجل تحذيرًا في السجلات مع تصدير كامل لحمولة SSO:

  • في كل مرة يتم فيها بدء عملية DiscourseConnect، سنسجل تحذيرًا في السجل مع تصدير كامل لحمولة DiscourseConnect.

  • في كل مرة يفشل فيها المستخدم في إكمال DiscourseConnect (بسبب انتهاء صلاحية الـ nonce أو حظر عنوان IP).

:spiral_notepad: هل تحتاج إلى أتمتة تسجيلات المستخدمين؟ راجع Auto-provisioning user accounts when SSO is enabled

174 إعجابًا
Discourse SSO + normal login
Sync DiscourseConnect user data with the sync_sso route
SSO login & logout issues
Is there a "log_in" SSO API endpoint?
SSO locked me out of Discourse!
What is the SSO login URL
With SSO my user still need to hit the login button
SSO Login page not showing up
How to handle Discourse SSO when the authentication site allows users to change emails?
"User Log out API" return success in response but user session still alive
SSO integration & external profile sync help
Single Sign-Out?
Mobile (firebase) SSO authentication
Discourse SSO using auth0 via URL
Login to Discourse with website account details
SSO on Discourse using Atlassian Crowd
Users who register on my site, register also on Discourse Vise Versa
Logout POST Request
Custom Login / Registration from another API
Advantage and disadvantage of enabling SSO
About the SSO category
Automatically assigning users to a group
Automatic session management with OAuth SSO
User Fields to validate users
Shibboleth / SAML / SSO -- Working Implementation for Higher Ed
Merging users from different forums
Customized login auth plugin
SSO and e-mail addresses having a plus sign
How to generate nonce from client-side Javascript
Will Discourse ask for a username if it's not provided to /session/sso_login?
Disable email verification for SSO
Discourse Ruby API testing "Unknown attribute 'auth_token' for User
[PAID] Setup SSO for self-hosted instance
Hashing Secret + Payload for SSO
SSO with TownNews CMS
Wordpress plugin not redirect to discourse login automatically
Categorizing and tracking users
Using existing RoR application for user auth / signup instead of discourse
SSO locked me out of Discourse!
Enable sso for my site
Auto-sign-in with the OpenId Connect Plugin and AWS Cognito
A way for admins to edit users' external IDs
Switching out authentication for a passwordless alternative
Segment Tracking Theme Component
Data explorer query to list the longest "estimated read time" topics?
Can usernames be numbers instead of Letters?
Create user in discourse by redirecting from another site
HMAC-256 example on Official SSO page
Discourse OAuth2 Basic
Jobs::DownloadAvatarFromUrl times out
Add links to meta.discourse.org instructions inside admin
How to configure the SSO Authorization URL via config (without using the admin panel)
Embed Discourse comments on another website via Javascript
TeamAndro exploring a migration from phpBB
DiscourseConnect payload hash encoding mismatch
Disabling SSO in development environment
Getting signed data from the server
User following invitation link is not visible in Admin/Users due to SSO
Getting signed data from the server
Getting signed data from the server
SSO and changing email addresses upstream
SSO (maybe) specific issue
SSO (maybe) specific issue
Why isn't Discourse more frequently recommended as a "community platform"?
Integration with .NET MVC application for a SaaS platform
Running my own discourse image
Unable to Login to Discourse, using wpdiscourse plugin
How do I make discourse use my platform's autentication system?
Automatic addition of users to group based on email domain
Allowing people to login using accounts from other websites
Seeking Slack Login / SSO for Discourse
Smooth J/K navigation when using keyboard
SSO to Joomla site
Discourse Connect on Local instance is not working
Discourse Connect on Local instance is not working
Implementing SSO for dev environment and troubleshoot
Login with FB, google and apple only
SSO provider implementation - Admin, moderator and groups ignored?
How to divide my community into 2 parts
Using Discourse to add a forum feature to our current application?
Shared cookie SSO: Notifying frontend
User auth with website at root and Discourse in subfolder
Can I authenticate to Drupal via Discourse?
Using Discourse as an authentication provider
Error 419 when Attempting DiscourseConnect, JavaScript
Difficulty of Tiered-access forum
Any way to not require email verification with WP as the SSO Provider?
How to auto-login user in application web view
How can I configure Single Sign On for our App to the Discourse Community Forum
[PAID] automatically change user email
Create apikey for user programmatically as admin
Discourse logins into Drupal 8/9
Discourse logins into Drupal 8/9
Bug when visiting same thread url
Open source will support customized provider SSO
Is there a way to get all emails of users with the API?
How can generate _forum_session and _t for an user through code/api call or without login to browser?
Show/hide forums based on the domain? (Shared forum via CNAME)
Integrate with DjangoRest and Vue.js
Auto-assign random, anonymous usernames
Connect Discourse Auth with my Django user DB?
Disable account confirm emails when creating users via API
Transforming usernames with SSO
WP as DiscourseConnect client: Signature parse error/Bad signature error (solved)
Automatically provision accounts with external SSO provider? (skip Create New Account prompt)
Error ArgumentError in DiscourseSsoController#sso, wrong number of arguments (given 1, expected 0)
Error ArgumentError in DiscourseSsoController#sso, wrong number of arguments (given 1, expected 0)
Embed variables in footer
Need help to setup SSO without emails
Programmatically log users out of discourse
Is it possible?
How do I remove people from putting names? I have an API system I want in there
How to detect Discourse user on Ghost Blog?
Problem in sso redirection for compose a new pre-filled topic via URL
How to make default avatars and make sure nobody changes there avatar I want to set them an avatar with my API system
How might we better structure #howto?
Making group joins automatic to an external pricing plan
Is Roblox Login Possible?
Session Timeout SSO after rebuild from Backup
Discourse login with whmcs users
2.7.0.beta4: DiscourseConnect, Topic Timer UI revamp, Login Modal UI revamp, and more
Connecting Discourse invites to Marketo emails
Auto assign member to the certain group
Connecting to an external source of avatars?
Changing avatar_url while sso_overrides_avatar is set?
SSO - User Roles or ACLs to differentiate access levels
SSO - User Roles or ACLs to differentiate access levels
User avatar selection through API no longer working
Sync WooCommerce Memberships with Discourse groups
Disabling email verification
SSO Isnt working for me
Could Discourse offer a StackExchange-like SSO/Federated login service?
Mandatory username & avatar generation - How can we do this?
Intergrading discoures in to a application
Configure single sign-on (SSO) with WP Discourse and DiscourseConnect
How to connect to an external database running on localhost
Automate User Creation
Login Help - Correct way to login
What happens to my current users after configuring SSO?
SSO groups without completely overriding
JumpCloud LDAP/SSO
Lexicon: a customizable native mobile app for your Discourse site
Usernames getting modified – numeral “1” being added
Is "partial" SSO possible?
Send an invite to a user but complete their profile programmatically
Magento 2 as SSO Provider?
Discourse SSO Provider doesn't redirect to return_sso_url as user logs in with custom SSO
Force password change after login
SSO and e-mail addresses having a plus sign
Would Discourse meet all of these niche needs to be a video game community forum?
OpenID Connect and SSO
Does `sso overrides groups` work with Oauth2?
How to prevent another log in with Auth0 and OAuth2 Basic Plugin
Add user to group after purchase
Error Log Missing
Discourseconnect logout issues
Shibboleth SSO with Discourse
Other custom code on WP installation is preventing WP Discourse from redirecting back to forum
Using discourse forum in a native app (log-in, languages)
Use Discourse as an identity provider (SSO, DiscourseConnect)
Possible to send an email login link via API?
Possible to send an email login link via API?
Self serve SSO email synchronisation
Discourse Connect: How implementing Discourse login with an existing database?
Sync group membership with external list of email addresses
Distrust: Discourse as an OpenID Connect provider
Admin sso and group permissions
Can I use my own Login page instead of discourse's Default login dialog box?
Using Discourse as SSO Provider for Wiki.js
SSO is forcibly creating the user as an admin
Modify the URL of 'create your account' button to an external site
DiscourseConnect Won't Let Me Log Back In
DiscourseConnect Won't Let Me Log Back In
DiscourseConnect Won't Let Me Log Back In
DiscourseConnect Won't Let Me Log Back In
Watched words links corrupt @mentions and #categories
Recursive Impersonation
Recursive Impersonation
How to add a custom url text link on the login page
Can discourse delete archived posts automatically and accept registration without email?
Drupal 8 and Discourse shared SSO
SSO is forcibly creating the user as an admin
Onboarding 15k Trial Users/Year: Need Help Streamlining the Process
Filling in discourse_username when not using DiscourseConnect
Is DiscourseConnect available for self-hosted?
Is DiscourseConnect available for self-hosted?
Discourse login by cookie token
Could you update user avatar for wordpress plugin sso?
Secondary Emails with SSO
How to Disable Required SSO Email Activation
Redirect to Register link after invite while using SSO
Custom field in discourseconnect
Make email optional
User avatar selection through API no longer working
Wordpress plugin not redirect to discourse login automatically
Discourse login by cookie token
How to configure Discourse as the sole user-facing login/sign-up provider for Wordpress site
Custom field in discourseconnect
System assigned profile picture not synced to Discourse Connect client sites
Discourse connect sync_sso avatar update issue
Discourse as OpenID Connect provider
Unable to create user in Discourse from WP with new registration form
Logging users in through c++ desktop application
Discourse as OpenID Connect provider
Is there any endpoint that would provide a user's external account IDs from their Discourse ID?
"Fake" OAuth Provider?
German People here
Invite only by email from database
Is it possible to autologin discourse via iframe?
New Wordpress users connecting to existing Discourse users
Login w/ Discourse w/o SSO?
Login w/ Discourse w/o SSO?
Login w/ Discourse w/o SSO?
Login w/ Discourse w/o SSO?
Generic “userN” usernames
Generic “userN” usernames
Change login link param (return_path)
Require accepting new terms (after changes) as a modal inside forum
Guest Gate Theme Component
Unable to Login to Discourse, using wpdiscourse plugin
How to switch from Discourse Connect SSO to local logins
Lack of Discourseconnect client tab in multisite for wordpress
Wordpress plugin not redirect to discourse login automatically
Wordpress plugin not redirect to discourse login automatically
Discourse Hosting Limits?
Guest Gate Theme Component
DiscourseConnect always returns "Nonce is incorrect, ..."
Auto Login enabled for public facing community?
Has anyone succeeded in using discourse as sso provider for nextcloud? Share recipe?
SSO in C# .NET App
Discourse SSO failed to login the user while redirection
Change email and username charset to unicode
Intergrate Discourse with keycloak
Auto Login enabled for public facing community?
Intergrate Discourse with keycloak
Intergrate Discourse with keycloak
Intergrate Discourse with keycloak
Intergrate Discourse with keycloak
Work with discourse users on an SPA
Work with discourse users on an SPA
WP-Discourse → User Switching Not Working
WP-Discourse → User Switching Not Working
Is there a way to use both local login and discourseConnect?
Allow my application users to login to discourse
Hide log out menu when using SSO
Discourse Integration Nextcloud bad csrf
Feature: create default user name from email's user portion when using Google OAuth2/SSO
Account login timed out when using SSO if auth_immediately = false
SSO login appears to have stopped working
Is there a way to use both local login and discourseConnect?
DiscourseConnect and user time zone / location
SSO Login issue
Configure an S3 compatible object storage provider for uploads
Use Discourse as an identity provider (SSO, DiscourseConnect)
"Fake" OAuth Provider?
Sync WooCommerce Memberships with Discourse groups
SSO Redirect Issues
Discourse Hosting Limits?
DiscourseConnect and user time zone / location
Embedding topics with login required and DiscourseConnect
WPDiscourse - Logout not working
Using Discourse as SSO provider but facilitating users continuing task on Wordpress?
Guest Gate Theme Component
"You need to sign in or sign up before continuing"
Any fallback available for failed SSO?
Changing email addresses not working as an Admin
Unable to anonymize user via API with SSO enabled
API bug : final "." in username causes error
Guest Gate Theme Component
Discourse Membership Synced with Member Status in other system (WHMCS)
Single sign-on sticks despite deleting the Discourse plugin
Populating email field on login page
Problem on SSO Login
API Create user external_ids parameter
Users unable to login with Discourse Connect
SSO Failing to Override Avatar
Manually copying over comments from Wordpress, how do I can create user accounts?
SSO Broken - The requested URL or resource could not be found
Auto approve email domains still requires staff approval
Intergrate Discourse with keycloak
Can I use the Discourse API to authenticate users in another app?
Adding Discourse to existing Ruby on Rails site
Only let staff unlink social accounts?
Use WP Discourse to publish posts from Wordpress to Discourse
Discourse Connect does not auto login anymore
Adding SSO after many users already signed up -- how to migrate them?
Update user details
Is it possible?
Is it possible?
Is it possible?
Is it possible?
Is it possible?
Is it possible?
Unable to create user in Discourse from WP with new registration form
Login error while trying to use Discourse as an identity provider (SSO, DiscourseConnect)
How to add custom query parameter in discourse connect url?
Can I use DiscourseConnect along with Discourse Native Registration?
How can we disable 2FA for an user while we are using google auth2 login in Discourse?
SSO Login with Discourse
Synchronize SSO login state between Discourse and provider
Connection and discourse account creation without going on discourse
Migrate an IPB 3.1 forum to Discourse
How to know if user has SSO
Email-less and password-less registration & authentication
Disable DiscourseConnect
Generating a login email via API
Any other way to authenticate user without redirecting to session/sso
SSO failover scenarios
How to use Discourse Connect (SSO) to update avatar, username, name?
How to use Discourse Connect (SSO) to update avatar, username, name?
How to use Discourse Connect (SSO) to update avatar, username, name?
Label Sets
An entirely email-less Discourse instance
Issue with Api
Invites keep getting error "not_matching_email"
Any other way to authenticate user without redirecting to session/sso
Bad automatic choosing of username when using SSO (DiscourseConnect)
Use Discourse as an identity provider (SSO, DiscourseConnect)
Unable to setup discourse in my windows 10
Ghost & Discourse SSO implementation
Is there a possibility for Discourse to integrate with web3 wallets?
Guest Gate Theme Component
Discourse SSO Configuration
How admin user re-logins after using discourse connect sso and custom domain
How admin user re-logins after using discourse connect sso and custom domain
How to set Authorization token in request headers when user attempts to login on discourse
How can I check in my website if the user is logged in to my Discourse?
Go from a Wordpress + Discourse structure to a Discourse site only?
Generating and retrieving user API keys
Wordpress avatars from Discourse when Discourse is the SSO provider
Discouse Connect avatar_url with S3
How to "intercept" first time SSO usages to let users confirm the SSO action and set a username?
Discourse Connect receive Discourse Approval state
Multiple development instances
Multiple development instances
How to create a login on my front-end application to a specific Discourse site?
How to create a login on my front-end application to a specific Discourse site?
Use Discourse as an identity provider (SSO, DiscourseConnect)
First time login for a user using API KEY
DiscourseConnect and Clickfunnels
Connect discourse with magento?
Can we combine 2 separate discourse sites?
Multisite vs multiple containers
Discourse login from external site
Users allowed to see only some categories
Add links to Discourse that allow users to authenticate via SSO or access private groups directly if they are logged in already
Using external_id via API
How to set Authorization token in request headers when user attempts to login on discourse
Discourse Connect Flow
Add links to Discourse that allow users to authenticate via SSO or access private groups directly if they are logged in already
Add links to Discourse that allow users to authenticate via SSO or access private groups directly if they are logged in already
Discourse Connect Flow
Issue with Drupal Discourse SSO
I keep getting logged out after implementing Discourse SSO
Wp_discourse unable to remember login status
Splitting a site into two parts
DiscourseConnect Provider Questions
Login error
DiscourseConnect Provider Questions
Create User external_ids parameter
Error creating account in Wordpress with Discourse Connect
Use Discourse Connect with Wordpress and regular login
How to add users to multiple groups using discourse connect?
The Sign up button is not activated
Admin status repeatedly revoked
Use Discourse Connect with Wordpress and regular login
Add user to group via webhook with email
Login error
Notify admins if a user updates their primary email
Customising hostname sent in email links for app deeplinking
Plugin to integrate Shopify accounts with Discourse
How to do single sign-on with forum program?
Exploring ways to partition a forum
Exploring ways to partition a forum
GET DiscourseConnect Single Sign On record via APIs
Simple login by email via deep links containing a username
While using DiscourseConnect, is the CONFIRM Account needed?
While using DiscourseConnect, is the CONFIRM Account needed?
Discourse Connect/Squarespace (SSO)
Discourse Connect/Squarespace (SSO)
Wordpress username publishing help
Wordpress username publishing help
How to set language for SSO users
Log in button Redirects Issue
Log in button Redirects Issue
Log in button Redirects Issue
Want to set internal forum on our reactjs member's platform
New instructions for SSO setup? "enable discourse connect" setting is missing
New instructions for SSO setup? "enable discourse connect" setting is missing
Bulk invite to group
Wordpress Groups Sync with Discourse
Add a new user via API
Configure GitHub login for Discourse
Seeking Guidance: Dual Authentication Setup for Moderators and Students
Seeking Guidance: Dual Authentication Setup for Moderators and Students
Anyone has discovered/ build a site as multisite (SSO), would like to see the possibilities for inspiration!
Use SSO to auto create Discourse login/password after signed up in my SaaS
Undefined method `kilobytes' for "100":String error breaks topic and avatar sync
"Login error" page during the login attempt by existing user previously added through SSO
"Login error" page during the login attempt by existing user previously added through SSO
Gate our community to just members of our Shopify site?
How best to engage Discourse for a larger WordPress magazine?
How best to engage Discourse for a larger WordPress magazine?
How can I change the registration URL?
How do I go about making a very customized theme?
An idea for more economical comments?
Unable to disable SSO via SSH
Is it possible to have an automatically updating link to a user's profile picture? Such as by giving each user one "slot" for an avatar?
SSO broken after rebuild with stable v3.3.3
Using Discourse Connect with a mobile app
Disable DiscourseConnect
Missing anchor links in certain TOC topics?
Integration into custom auth system where emails are not unique?
WP-Discourse not connected and admin email not recognized
How to disable SMTP during installation?
How to enable sso on discourse?
Create User external_ids parameter
Auto Login to my Discourse site / subdomain
How to Disable activation_reminder email sending?
Communities using discourse SSO for their in-app community experience
Extending header buttons
Auth via Discourse Forum
🧩 How to Build an Android App User Community with Discourse? [HeyApks Project]
Postgres doesn't seem to be running when running Discourse locally using Docker
Discourse sso login redirect to localhost:3000, not 4200 (running via docker)
Cross-Discourse Quoting
Is it Possible to Send Encrypted Email and Password in the Authentication Flow?
Nutzung von Nextcloud aus Discourse heraus
Inherited forum with old Discourse Connect Config and Looking for Some Guidance
Merging user accounts
Understanding PII storage in Discourse
Auto-provisioning user accounts when SSO is enabled
REQUEST: Highly Effective Age Assurance (OneID Phone No. Age Verification) Integration
Guest Gate Theme Component
Login to Discourse with custom Oauth2 provider
Can I log into multiple instances of discourse simultaneously?
Upgraded last night and login button no longer works
SSO with Roles translating to Groups
Redirect login possible?
How to disable SSO via SSH
Connect Multiple WP Sites To 1 Discourse Installation?
What is the procedure to obtain CAS between my website and my discourse instance?
Problem logging in using SSO plugin
PAID: Create Open Source SSO plugin to auth with Wild Apricot
Trouble connecting drupal and discourse
About the idea: IDENTITY = EMAIL
About the idea: IDENTITY = EMAIL
How to create members-only site with Discourse, WordPress, and LearnDash
Consequences of not validating email addresses
SSO and Restricted Groups
Questions about Discourse on Digital Ocean
Require users to join at least one group at sign-up
Use the same user database and login credentials in multiple discourse instances
How to connect my (existing) User Database?
Can usernames be numbers instead of Letters?
User group sync with drupal
Options with SSO with another custom application
Issues in Integrating SSO in Discourse
How to implement Discourse with an already built Rails project
Updating SSO documentation
Configuring SSO to Work With SocialEngine
Updating SSO documentation
Discourse view file update does not reflect in browser
Discourse view file update does not reflect in browser
Trying to set up SSO
Discourse doesn't re-verify an address changed by SSO
Discourse doesn't re-verify an address changed by SSO
User API keys specification
SSO and Discourse Consulting
Changing the unique key to identify users
Setting the user title(group?) based on the information that is coming from the sso payload
TL2 welcome message sent every time on SSO login
Error during SSO integration - Wholistic Minds
Advice needed for tailoring Discourse to my organisation
Rails error when using DiscourseConnect and Wordpress
Primary and Discourse Site Integrations
Automatic Table of Contents generation
Questions Regarding Account Authentication Methods
Can usernames be numbers instead of Letters?
Redirect all users who click on domain.com/signup to a different page
Poll Result Breakdown
Cant update email via API - invalid_access error
Disabling all emails except those registration related?
Allow admins to change email addresses easily
Can't get avatar overrides to work over SSO
Allow admins to change email addresses easily
Conflicting email addresses, giving admins more power to resolve issues
Unable to create user in Discourse from WP with new registration form
Which Discourse hosting tier should I choose?
New users via API if allow new unchecked
How to change login settings without being logged in?
A community of a no-code tool: SSO vs login via email

مرحباً، من الصعب عليّ العثور على أي شيء، ولكن ما هو البروتوكول الذي يستخدمه هذا؟ هل نفترض أنه oauth2؟ لا تبدو المعلمات متطابقة، وأحصل على خطأ من المزود يبدو أنه يقبل معلمة sso=؟ ساعدني!

شكراً

DiscourseConnect هو تطبيق Discourse لـ SSO. لا يستخدم بروتوكولًا قياسيًا.

إذا كنت لا تمانع في النظر إلى كود PHP، فهناك مثال للتنفيذ هنا: wp-discourse/lib/sso-provider/discourse-sso.php at main · discourse/wp-discourse · GitHub.

نعم، هذا لن ينجح. إذا كان لديك موفر OAuth2 ترغب في استخدامه للمصادقة على المستخدمين، فراجع المكون الإضافي Discourse OAuth2 Basic.

إعجاب واحد (1)

شكراً @simon. هل رمز PHP هو مزود أيضًا، وليس مستهلكًا؟ رأيت أيضًا مزود OIDC قد يعمل وكذلك مزود “الوسيط” في منطقة الإضافات.

إذا كان مزود SSO غير قياسي، فمن/ما هو المقصود به إذا لم يكن متوافقًا مع الآخرين؟

شكرًا مرة أخرى!

الكود الذي ربطته هو لاستخدام ووردبريس كمزود للمصادقة لـ Discourse.

تسمح إضافة ووردبريس أيضًا باستخدام ووردبريس كعميل لـ DiscourseConnect: wp-discourse/lib/sso-client at main · discourse/wp-discourse · GitHub.

لست متأكدًا من الدافع وراء إضافة تطبيق SSO مخصص إلى Discourse. أخمن أنه كان هناك سبب تجاري لذلك.

إحدى الفوائد التي يوفرها هي أنه يسمح بدمج موقع خارجي بشكل وثيق مع Discourse. على سبيل المثال، يمكن مزامنة جميع سمات المستخدم المدرجة هنا مع Discourse أثناء عملية المصادقة: discourse/lib/discourse_connect_base.rb at 7b89fdead98606d4f47ceb0a1d240d0f6e5f589e · discourse/discourse · GitHub.

كما يسمح باستخدام المواقع التي لم يتم تكوينها لتكون مزودات OAuth2 أو OpenID Connect لمصادقة المستخدمين على Discourse.

العيب هو أنه يتطلب إضافة بعض التعليمات البرمجية المخصصة إلى موقع مزود المصادقة.

إعجاب واحد (1)

مرحباً، أنا فضولي لمعرفة المشكلات المتعلقة بعدم التحقق من عناوين البريد الإلكتروني على موقع خارجي يوفر تسجيل الدخول الموحد (SSO). هل هو فقط أنه يتيح البريد العشوائي الآلي؟ أم أن هناك اعتبارات أخرى؟ لماذا لا يُنصح بأن يتعامل Discourse مع التحقق من البريد الإلكتروني إذا كان الموقع الخارجي لا يفعل ذلك؟

شكراً لأي رؤى إضافية.

أسوأ سيناريو أعرفه يتطلب هذه الشروط:

  • لم يتم التحقق من عناوين البريد الإلكتروني على الموقع الخارجي
  • لم يتم تعيين require_activation=true في حمولة SSO
  • توجد حسابات حالية على موقع Discourse لا ترتبط بها SingleSignOnRecord (لم يسجل مالك الحساب في Discourse باستخدام SSO مطلقًا)

في هذه الحالة، يمكن لشخص ما التسجيل في الموقع الخارجي باستخدام عنوان البريد الإلكتروني الخاص بمستخدم Discourse الذي لم يسجل الدخول مطلقًا عبر SSO. سيسمح هذا للحساب غير المتحقق منه من الموقع الخارجي بالاستيلاء على حساب Discourse الذي يستخدم نفس عنوان البريد الإلكتروني. سيكون هذا مقلقًا بشكل خاص إذا كان حساب مسؤول على Discourse.

يُنصح بأن يتولى Discourse التحقق من البريد الإلكتروني إذا لم يكن الموقع الخارجي يقوم بذلك:

هناك عدد قليل من الأسباب التي تجعل من الأفضل التعامل مع التحقق من البريد الإلكتروني على الموقع الخارجي:

  • إجبار المستخدمين على تلقي البريد الإلكتروني التأكيدي من Discourse يضيف بعض الاحتكاك عند محاولة المستخدمين تسجيل الدخول إلى Discourse لأول مرة. (في الواقع، يجب أن يحدث هذا الاحتكاك في مكان ما - إما على جانب Discourse أو على جانب الموقع الخارجي.)
  • لن يقوم Discourse بمطابقة حسابات Discourse الحالية مع تسجيلات الدخول الخارجية بناءً على عنوان البريد الإلكتروني إذا تم تعيين require_activation على true في حمولة SSO. هذه مشكلة إذا قمت بتمكين DiscourseConnect بعد إنشاء بعض الحسابات على Discourse عن طريق التسجيل باسم مستخدم / كلمة مرور. إنها أيضًا مشكلة إذا احتجت في أي وقت إلى حذف إدخالات SingleSignOnRecord على Discourse. لن يقوم Discourse بإنشاء إدخالات SingleSignOnRecord جديدة تلقائيًا عندما يحاول المستخدمون تسجيل الدخول مرة أخرى إلى Discourse.
4 إعجابات

شكراً لك، @simon - هذا مفيد جداً!

مرحباً، لدي سؤال حول حقل groups في حمولة SSO.

هل سيتم أيضاً تجاوز المجموعات الآلية (مثل المسؤولين والمشرفين ومستويات الثقة)؟ أم سيتم الاحتفاظ بها؟

لا! بافتراض أن وصف هذا الإعداد صحيح، فإنه سيؤثر فقط على المجموعات اليدوية.

أتعلم… لم أر كلمة “يدوي” في الوصف. يبدو واعدًا لحالة الاستخدام الخاصة بي، سأجربه وأبلغكم بالنتائج.

إعجاب واحد (1)

عندما قرأت هذا، اعتقدت أنه كان من المفترض أن أقوم بإنشاء التوقيع مباشرة من الحمولة المشفرة بـ Base64. لم أدرك أنك بحاجة إلى إنشائه من بايتات UTF-8. هل يمكن توضيح ذلك؟

لقد كنت ألعب بـ DiscourseConnect - التوثيق رائع، شكرًا لكم.
ومع ذلك، لقد واجهت بعض العقبات التي آمل الحصول على بعض المساعدة/التوضيح بشأنها.

نريد أن يتمكن المستخدمون من تسجيل الدخول إلى ووردبريس باستخدام تسجيل دخول ديسكورس الخاص بهم (وهذا يعمل بشكل جيد :slight_smile: ) - ومع ذلك.

  • هل من الممكن إنشاء مستخدم ووردبريس عبر تسجيل ديسكورس (عندما ينشئ المستخدم حساب ديسكورس، يتم تلقائيًا إنشاء حساب/ملف تعريف ووردبريس لهم حتى يتمكنوا من تسجيل الدخول إلى ووردبريس)

  • هل من الممكن مزامنة مجموعات مستخدمي ووردبريس ومجموعات ديسكورس.
    إذا كان لدى المستخدم حساب مستخدم في كل من ووردبريس وديسكورس، فإن DiscourseConnect قادر على ربطهما - ولكنه لا يمنح حساب ووردبريس مجموعات المستخدمين لمجموعات ديسكورس بنفس الاسم، والعكس صحيح (وماذا عن إذا لم يكن للمجموعات نفس الاسم - كيف يمكنني إخبار DiscourseConnect بمنح مجموعة المستخدمين “مجموعة اختبار” عندما يكون لدى المستخدم مجموعة ديسكورس “مجموعة لاختبار الأشياء”؟

ما الذي أفتقده؟

لا أعرف الإجابة، ولكن…

كن حذرًا بشأن ذلك. إنه في مكان غير قانوني ويعتبر ممارسة سيئة على نطاق واسع (باستثناء مالكي المواقع بالطبع :smirking_face:) لأنه سيحدث دون موافقة المستخدم ومعرفته، وفي نفس الوقت سيتم نقل البيانات إلى مكان آخر.

بالتأكيد، هذا في منطقة رمادية إلى حد ما، وبشكل أساسي، على سبيل المثال، جوجل تفعل ذلك.

ولكن… لماذا؟ قصر تسجيل الدخول على Discourse SSO فقط من جانب ووردبريس وإعادة توجيه المستخدمين إلى Discourse لإنشاء الحساب وهذا كل شيء. ولكن على حد علمي، لا يمكنك مزامنة حسابات المستخدمين تلقائيًا فور إخراجها من الصندوق. ولماذا يجب عليك ذلك، لأنه مع SSO يحدث ذلك عندما يحتاجه المستخدم.

في السيناريو الخاص بنا (كمنظمة عضوية)

  • يتم استخدام ووردبريس لإدارة الاشتراكات، وشراء العناصر من متجر ووردبريس، ونستخدم مجموعات المستخدمين لإدارة ما يمكن للعضو القيام به في المنظمة
  • ديسكورس هو منتدانا/مجتمعنا عبر الإنترنت ونستخدم المجموعات للتحكم في المناطق التي يمكن للمستخدم الوصول إليها في ديسكورس)

حاليًا، يحتاج العضو الجديد إلى إعداد حساب ووردبريس (وإعداد اشتراكه وما إلى ذلك) وأيضًا إعداد حساب ديسكورس، ويتم إدارة/مزامنة مجموعات المستخدمين-مجموعات ديسكورس يدويًا.

أحاول إيجاد حل يقوم فيه المستخدم الجديد بإعداد مرة واحدة لإنشاء كلا الحسابين، ويتم مزامنة مجموعات المستخدمين-مجموعات ديسكورس تلقائيًا - أنا متأكد من أنني أستطيع حل مزامنة المجموعات باستخدام واجهات برمجة التطبيقات وما إلى ذلك. إنها إعدادات حساب المستخدم المتعدد التي أحاول حلها/تجنبها.

يبدو أن ما تفعله هو استخدام ديسكورس كموفر للمصادقة الأحادية (SSO) لووردبريس. هذا النهج موضح هنا: استخدام ديسكورس كموفر هوية (SSO، DiscourseConnect). يحتوي المكون الإضافي لووردبريس الخاص بديسكورس على خيارات لاستخدام ووردبريس كموفر للمصادقة الأحادية لديسكورس، أو لاستخدام ديسكورس كموفر هوية لووردبريس. يؤدي استخدام نفس الاسم لكلا النهجين إلى بعض الارتباك.

أود أن أميل إلى استخدام ووردبريس كموفر هوية في هذه الحالة. مع هذا النهج، سيقوم المستخدمون بإنشاء حسابات على موقع ووردبريس الخاص بك ثم تسجيل الدخول إلى ديسكورس باستخدام بيانات اعتماد ووردبريس الخاصة بهم. أحد الأشياء التي يجب الانتباه إليها في هذا النهج هو أنه يعني أن المستخدمين سيتمكنون فقط من تسجيل الدخول إلى ديسكورس عبر ووردبريس، ولن يكون من الممكن إنشاء حساب ديسكورس دون امتلاك حساب ووردبريس بالفعل. أعتقد أن هذا هو الإعداد المناسب عند دمج ديسكورس مع موقع عضوية ووردبريس.

عند استخدام ووردبريس كموفر هوية لديسكورس، هناك عدد قليل من وظائف الأدوات المساعدة المفيدة لتعيين عضويات مجموعات ديسكورس للمستخدم بناءً على نشاطه في ووردبريس. تم توضيح هذه الوظائف هنا: إدارة عضوية المجموعة في ديسكورس باستخدام WP Discourse SSO.

بالعودة إلى سؤالك الأصلي:

لقد مر وقت طويل منذ أن نظرت في كود عميل DiscourseConnect الخاص بالمكون الإضافي لووردبريس، ولكن أعتقد أن ما تطلبه هو أكثر أو أقل بالطريقة التي يتوقع بها هذا الكود العمل. إذا كان لدى المستخدم حساب ديسكورس، فكل ما يحتاجون إليه هو النقر على رابط “تسجيل الدخول عبر ديسكورس” في ووردبريس وسيتم إنشاء حساب لهم.

سيكون هذا ممكنًا تقنيًا عند استخدام ووردبريس كعميل DiscourseConnect، ولكن ما لم يتغير شيء ما، فلن تتمكن من استخدام طرق add_user_to_discourse_group و remove_user_from_discourse_group الموضحة في الوثائق التي ربطتها. ستحتاج إلى القيام بشيء مثل إعداد خطاف ويب (Webhook) لديسكورس يتم تشغيله عند إضافة مستخدم إلى مجموعة ديسكورس، ثم إضافة بعض التعليمات البرمجية في ووردبريس لمعالجة خطاف الويب هذا. لمزامنة المجموعات من ووردبريس إلى ديسكورس، ستحتاج إلى إجراء استدعاء API إلى ديسكورس لتحديث مجموعات المستخدم عند حدوث تغيير في ووردبريس. لذلك، قد يكون الشيء الذي يسهل تحقيقه نسبيًا إذا كنت تستخدم ووردبريس كموفر لـ DiscourseConnect معقدًا إلى حد ما إذا كنت تستخدم ووردبريس كعميل لـ DiscourseConnect.

إعجاب واحد (1)

باستثناء إذا تم استخدام تسجيل دخول مخصص، كما هو الحال عادةً مع WooCommerce/memberships/LLM التي تعرض هذا الزر وتفرض استخدام Discourse SSO كموفر وحيد، فهذا لا يحدث بشكل افتراضي ويتطلب بعض العمل المخصص.

هناك عدد قليل من المشاكل المحتملة، واحدة تتعلق بالتخزين المؤقت وأخرى تتعلق بإعادة توجيه تسجيل الدخول التي تضيفها بعض الإضافات. يجب على أي شخص يواجه هذه المشاكل أن يسأل عنها في فئة Support > WordPress. عادة ما يتم حلها بسهولة.

لقد نسيت تمامًا أن أبلغك: بالفعل يعمل تمامًا كما هو موصوف، وتتأثر المجموعات اليدوية فقط.

مرحباً @simon،
أعتقد أنني بحاجة ماسة إلى بعض المساعدة بشأن استجابة 404 من استكشاف إثبات المفهوم (POC) لهذه الميزة SSO. لقد كنت أعمل على هذه المشكلة ليوم كامل، لكنني ما زلت غير قادر على تحديد المشكلة. تمكنت من:

  1. تمكين discourse_connect
  2. تعيين discourse_connect_url إلى https:/ /localhost:4200/login
  3. سر discourse-connect: 20’s (1) 1111111111111111111 لتبسيط الأمر.

ثم في صفحة تسجيل الدخول الخاصة بتطبيق Angular الخاص بي، أرسلت هذا الطلب باتباع الكود:


لكنني تلقيت استجابة 404 غير موجود.

لفهمي، أثناء إرسال طلب POST إلى نقطة نهاية admin/users/sync_sso، إذا لم يكن المستخدم موجودًا في discourse، فيجب عليه إنشاء مستخدم جديد بناءً على user_id والبريد الإلكتروني، ثم يجب أن تكون النتيجة المرتجعة كائن مستخدم وليس كائنًا فارغًا مع رمز الحالة 404.
لقد تحققت أيضًا من السجل ولم يقدم أي معلومات ذات صلة لهذه الاستجابة الفاشلة.

شكراً مقدماً!