Ciao, vorrei incorporare il forum in un sito web tramite iframe.
Il forum effettuerà il login tramite SSO. L’incorporamento tramite iframe funziona correttamente. Tuttavia, il processo SSO non riesce a impostare il cookie di login perché l’attributo ‘samesite lax’ è impostato lato Discourse. Qualcuno ha riscontrato lo stesso problema? O c’è qualcuno che è riuscito a incorporare il proprio forum in un sito web e a collegarlo tramite 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.
Proveremo a utilizzare un’intestazione e un piè di pagina personalizzati.
Ci sono piani, nel prossimo futuro, per rendere il discorso SSO funzionante all’interno di un iframe? Questa funzionalità sarebbe molto utile per chi desidera integrare un forum nel proprio sito senza dover implementare tutte le API di Discourse.
Utilizziamo già il forum con SSO all’interno di una webview in un’app. Vogliamo integrare il forum in un nuovo sito web che stiamo costruendo. Credo che abbiamo due opzioni per farlo:
Opzione 1: implementare diverse API (ad esempio per recuperare post, categorie e pubblicare su Discourse).
Opzione 2: incorporare il forum nel nostro sito web tramite iframe in combinazione con SSO. (costo contenuto e ci permette di valutare il successo del forum prima di investire ulteriormente)
Quindi, per rispondere alla tua domanda: l’opzione dell’iframe non ha nulla a che vedere con le API.
Ci sono piani nel prossimo futuro per far funzionare Discourse SSO all’interno di 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.