Problema com SSO do fórum Discourse em iframe

Olá, quero incorporar o fórum dentro de um site usando iframe.

O fórum fará login via SSO. O iframe funciona corretamente, mas o processo de SSO não consegue definir o cookie de login porque o atributo ‘samesite lax’ está configurado no lado do Discourse. Alguém também enfrentou esse problema? Ou alguém conseguiu incorporar seu fórum em um site e conectá-lo via SSO?

Obrigado antecipadamente.

1 curtida

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 curtidas

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 curtidas

Obrigado pela sua resposta.

Vamos tentar usar um cabeçalho e rodapé personalizados.
Existem planos para o futuro próximo de fazer o discourseSSO funcionar dentro de um iframe? Essa funcionalidade seria muito útil para quem deseja incluir um fórum em seu site sem precisar implementar todas as APIs do Discourse.

What does an iframe have to do with APIs?

Prezado Stephan,

Já utilizamos o fórum com SSO dentro de um WebView em um aplicativo. Agora queremos integrar o fórum em um novo site que estamos construindo. Acredito que temos duas opções para isso:

Opção 1: Implementar várias APIs (por exemplo, para recuperar posts, categorias e publicar no Discourse).

Opção 2: Incorporar o fórum em nosso site usando iframe, em combinação com SSO (solução mais econômica e que nos permite avaliar se o fórum será um sucesso antes de investir mais nele).

Portanto, para responder à sua pergunta: a opção de iframe não tem relação com as APIs.

Existem planos para fazer o Discourse SSO funcionar em um iframe no futuro próximo?

1 curtida

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 curtidas