Quando um usuário faz login no meu site, obtenho o JWT e também o loga no Discourse imediatamente. Ao final desse fluxo, ele acaba no site do Discourse em vez de retornar ao meu site.
Tentei verificar os métodos de redirecionamento da biblioteca omniauth, que incluem o parâmetro origin e o cookie destination_urldesta fonte. Nenhum deles parece funcionar.
EDIT: Acabei de perceber que estive olhando para duas bibliotecas diferentes: omniauth e os callbacks omniauth do Discourse. De qualquer forma, ainda não tenho certeza de como fazer isso funcionar.
I don’t think this is a supported path. In general, a user would be on discourse, click login, visit your site for auth and be redirected back. If a user logs in directly on your site, they should stay on your site.
Typically how we do this is keep Discourse logged out, but when they click “Login” it’ll redirect back without having to fill out the authentication form again.
So, the embeds do make use of the auth session (or the session cookie) to show or hide private discourse topics.
This auth flow does make sense, but for starters, I’m going to redirect people to the discourse forum for login on a new tab. They will be able to access private topics after a refresh.