# Preserve /new-topic intent after SSO login

**URL:** https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464
**Category:** Support
**Created:** [5월 23, 2019, 12:30오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464 "2019-05-23T00:30:45Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JulesW](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julesw/32/141290_2.png) [@JulesW](https://meta.discourse.org/u/JulesW)
#### Post date: [5월 23, 2019, 12:30오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/1 "2019-05-23T00:30:45Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [5월 23, 2019, 12:53오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/2 "2019-05-23T00:53:52Z")

</div>

> [@JulesW](#):
>
> 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.

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:

```html
<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 a DiscourseConnect login link](https://meta.discourse.org/t/create-an-sso-login-link/109290) topic for more details.

---

<div class="post-metadata">

### Author: ![JulesW](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julesw/32/141290_2.png) [@JulesW](https://meta.discourse.org/u/JulesW)
#### Post date: [5월 23, 2019, 1:02오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/3 "2019-05-23T01:02:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![JulesW](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/julesw/32/141290_2.png) [@JulesW](https://meta.discourse.org/u/JulesW)
#### Post date: [5월 23, 2019, 1:11오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/4 "2019-05-23T01:11:33Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [10월 9, 2022, 2:18오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/5 "2022-10-09T02:18:56Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [11월 8, 2022, 2:19오전 UTC](https://meta.discourse.org/t/preserve-new-topic-intent-after-sso-login/118464/6 "2022-11-08T02:19:34Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
