مشكلة SSO في Discourse ضمن iframe

مرحبًا، أود تضمين المنتدى داخل موقع ويب باستخدام iframe.

سيتم تسجيل الدخول إلى المنتدى عبر SSO. يعمل التضمين بشكل صحيح، لكن عملية SSO لا تستطيع تعيين كوكب تسجيل الدخول لأن سمة “samesite lax” مضبوطة من جانب Discourse. هل واجه أي شخص هذه المشكلة أيضًا؟ أو هل تمكن أي شخص من تضمين منتداه داخل موقع ويب وربطه عبر SSO؟

شكرًا مقدّمًا.

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

Just letting you know that Discourse does not work well (if at all) in an iframe. So you’re already asking for troubles :wink:

3 إعجابات

Thanks for the very very quick response :slight_smile:

Hmm okay, well I found a setting in the discourse settings section. This allows the forum to be iframed into another site. This setting works (if you are already logged in and have the cookie).

The only thing which doesn’t work is the sso process. Our sso process works fine and correct when opening the forum in a new tab. But the iframe breaks this process because the cookie with the accesstoken cannot be set due to a different domain. This leads to an endless loop inside of the iframe because discourse can’t find this cookie and starts the sso process again.

As this is very important for us, isn’t there any option to iframe the forum whilst using sso authentication?

The setting is pretty experimental and not really supported in an sso environment. The redirect back would need to do some fancy work to pass all the information back into the frame.

I strongly recommend you just go with a custom header and footer, it is very easy to set it up so it looks like the main site.

3 إعجابات

شكرًا على ردك.

سنحاول استخدام ترويسة وتذييل مخصصين.
هل توجد خطط في المستقبل القريب لجعل discourseSSO يعمل داخل إطار مضمن (iframe)؟ ستكون هذه الميزة مفيدة جدًا للأشخاص الذين يرغبون في تضمين منتدى في موقعهم دون الحاجة إلى تنفيذ جميع واجهات برمجة التطبيقات الخاصة بـ Discourse.

What does an iframe have to do with APIs?

عزيزي ستيفان،

نحن نستخدم بالفعل المنتدى مع نظام الدخول الموحد (SSO) داخل عرض ويب (WebView) في تطبيق. ونرغب في دمج المنتدى في موقع ويب جديد نبنيه. وأعتقد أن لدينا خيارين لذلك:

الخيار الأول: تنفيذ عدة واجهات برمجة تطبيقات (APIs) (على سبيل المثال، لاسترجاع المنشورات والفئات والنشر في منصة Discourse).

الخيار الثاني: تضمين المنتدى في موقعنا الإلكتروني باستخدام إطار مضمن (iframe) مع نظام الدخول الموحد (SSO). (وهو خيار فعال من حيث التكلفة، ويمكننا من خلاله تقييم نجاح المنتدى قبل الاستثمار فيه).

لذا، للإجابة على سؤالك: لا يرتبط خيار إطار العرض المضمن (iframe) بأي من واجهات برمجة التطبيقات (APIs).

هل توجد خطط في المستقبل القريب لجعل نظام الدخول الموحد (Discourse SSO) يعمل داخل إطار مضمن (iframe)؟

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

The SSO protocol redirects to your site, you then perform auth and redirect back to our site.

If one is to setup an IFRAME here, the redirect you perform once you authenticated the user would have to go to your site, it then would have to do some sort of magic to pass the information back into the IFRAME.

This is technically complex and very hard to get right. On the other option of custom footer and header is both technically way simpler to implement, way less error prone and as an added bonus faster cause you are not forced to make 2 separate requests to build up a page.

3 إعجابات