a.golmirzaei is implementing a custom SSO provider for Discourse and reports an issue: when a logged-out user opens a pre-filled topic URL, they are redirected to SSO, log in, and return to Discourse — but the pre-filled topic data is lost, and they instead see the latest topic page. They confirm that SSO redirection works correctly when logging in from within a specific topic. simon suggests using the method outlined in this meta thread for pre-filled messages, adapting it for topics. a.golmirzaei initially tries adding return_path to the SSO login URL (with payload and sig) but fails. simon clarifies that return_path should be added to the initial link users click — not to the SSO callback — and that payload and sig are handled automatically by the SSO flow. The return_path should point to /new-topic?title=...&body=... (or similar) to pre-fill a topic, not a message. After applying this correctly, a.golmirzaei confirms the solution works.
I am implementing my own authenticating service as SSO provider for discourse. Its working fine. But when my users (not logged in users) open a pre-filled topic URL then they wont see those pre-filled data after redirect back to discourse.
full scenario:
Not logged in user opens a pre-filled topic creation URL
He automatically redirected to SSO page
He logged in using SSO and redirect back to http://discourse_site/session/sso_login?....
Here I expect user to see topic creation box with filled data but discourse just shows latest topic page. Not even showing the create topic box
Can anyone help me on this issue? Are there any problem in my setting or its a bug?
I can also confirm that if I am in a specific topic and press login the redirect will work fine and I will return to that topic.
Thank @simon for your replay. Unfortunatly I couldn’t make it working. In your link it said to use a url like
http://localhost:3000/session/sso?return_path=http%3A%2F%2Flocalhost%3A3000%2Fnew-message%3Fusername%3Dscossar%26title%3DInformation+requested+about+gentle+yoga+classes
Firstly I supposed to add it to stage 6 of official discourse SSO doc. So it would be like:
But it didn’t work. So I start to test it in different places and none of them worked. Would you please elaborate more on were I should put return_path?
All you should need to do is create a link in the form given in that post. You’ll need to substitute the correct URL of your Discourse site, and change the username from scossar to a username that exists on your site. Do not add the payload or sig parameters to the link. That should all be taken care of by your existing SSO implementation. All that the return_path parameter is doing is redirecting the user to a URL that will create the prefilled topic.
Note that in the example I linked to, I’m creating a prefilled message, not a prefilled topic. You’ll need to adjust the return_path given in the example code to create a topic instead of a message.