Bonjour, je souhaite intégrer le forum dans un site web via une iframe.
Le forum se connectera via SSO. L’intégration par iframe fonctionne correctement. Cependant, le processus SSO ne peut pas définir le cookie de connexion car l’attribut ‘samesite lax’ est défini côté Discourse. Quelqu’un a-t-il également rencontré ce problème ? Ou quelqu’un a-t-il réussi à intégrer son forum dans un site web via une iframe et à le connecter via SSO ?
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.
Nous allons essayer d’utiliser un en-tête et un pied de page personnalisés.
Y a-t-il des projets prévus dans un avenir proche pour permettre au système Discourse SSO de fonctionner dans un iframe ? Cette fonctionnalité serait très utile pour les personnes souhaitant intégrer un forum sur leur site sans avoir à implémenter toutes les API de Discourse.
Nous utilisons déjà le forum avec SSO dans une webview au sein d’une application. Nous souhaitons intégrer le forum dans un nouveau site web que nous sommes en train de construire. Je pense que nous avons deux options pour cela :
Option 1 : implémenter plusieurs API (par exemple, récupérer des publications, des catégories et publier sur Discourse).
Option 2 : intégrer le forum dans notre site web via un iframe en combinaison avec SSO. (solution économique et nous pouvons vérifier si le forum est un succès avant d’y investir davantage).
Ainsi, pour répondre à votre question : l’option iframe n’a rien à voir avec les API.
Y a-t-il des projets prévus dans un proche avenir pour permettre à Discourse SSO de fonctionner dans un iframe ?
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.