main ← fix-redirect-when-using-discourse-connect
merged 04:52PM - 08 Aug 25 UTC
When an "anon" user visits a topic that is "private", they will get a page that …is server-rendered and doesn't load the client-side app.
When they click the "login" button, it will redirect to the /login route which loads the app. The only way we can know where the user landed initially is via the "document.referrer".
The issue was that the code that checked the referrer was **after** the code that is doing the redirection to discourse connect.
By putting the code before doing the redirection to discourse connect, we are successfully redirected to the landing url after doing the discourse connect auth.
I've also added a system spec that test the happy path by starting the most basic discourse connect compliant sso server in the background.