Preserve /new-topic intent after SSO login

I’m using SSO to perform logins with Discourse as the consumer.

When I send a user to a /new-topic?title=blah - and they’re not yet logged into discourse - they are redirected to perform SSO.

Upon SSO completion, Discourse does not return them to this new-topic where they were login-bounced from, instead it sends them to the Latest Posts page.

Seems to me that the expected behaviour would be to preserve the user flow by returning them to the link where the login bounce was triggered?

This can be made to work. You need to send the user to /session/sso?return_path=/new-topic?title=your topic title.

A full link would look something like this:

<a href="https://forum.example.com/session/sso?return_path=/new-topic?title=this is another test topic">New Topic</a>

Have a look at the Create an SSO login link topic for more details.

2 Likes

Works perfectly; thanks! Also solves another question I had about forcing a login and then redirecting to the desired forum page.

One thing I’m noticing about the /session/sso endpoint is that - even if the user is already logged into Discourse - they still get bounced to perform another SSO login.

That seems redundant and incurs a performance penalty with the unnecessary triple redirect. Is there a way to prevent that?