"push" sso users to discourse?

We want to programmatically create new topics for our users from a backend service. Is it possible to push a SSO user to discourse without them going through the login flow?

If you are using DiscourseConnect to authenticate users on your site, you can create or update users programmatically with this method: Sync DiscourseConnect user data with the sync_sso route. Note that this doesn’t log the user into Discourse, it just creates the user. If that is not what you are trying to accomplish, send us more details about what you are wanting to do.


We are! That’s perfect.

Incidentally, we wouldn’t need to do this if the new topic parameters survived the SSO sign on flow. We can’t find the right incantation to make that work, though, so it dumps people to a blank topic form if they aren’t already logged in. I can file that as a bug somewhere if you consider it a bug. :slight_smile:

1 Like

It should be possible to get that to work. If the parameters are being stripped, I suspect they are being stripped by the SSO code you are using, not by Discourse. Have a look at this post for details: Compose a new pre-filled personal message via URL - #11 by simon. Note that the example URL in that post is creating a new PM, not a new topic. The same approach should work for creating a new topic though.

1 Like

Oh that does work! Nice. This URL doesn’t return to right, but it’s super easy to link to the SSO URL:

1 Like