# SSO Login redirection issue

**URL:** https://meta.discourse.org/t/sso-login-redirection-issue/110103
**Category:** Support
**Tags:** subfolder
**Created:** [February 26, 2019, 8:56am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103 "2019-02-26T08:56:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [February 26, 2019, 8:56am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/1 "2019-02-26T08:56:55Z")

</div>

Hi, I have deployed discourse on vm, and configured sso, Also have configured application gateway, we have set a path rule /community for forum, on hitting /community/session/sso the app authorises and redirects back to the main website.  
For example: on hitting [https://mymainwebsite.com/community/session/sso](https://mymainwebsite.com/community/session/sso) i am automatically redirected back to [https://mymainwebsite.com](https://mymainwebsite.com).  
When i check the log it has authorised token but at the end it is redirecting to main site.

 ![48%20PM](https://global.discourse-cdn.com/meta/original/3X/2/3/23510e0b04ccc725888bc981dc341bc3be8d7a43.png)

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [February 26, 2019, 9:19am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/2 "2019-02-26T09:19:22Z")

</div>

Duplicate of

> [@Subfolder SSO Login redirection issue](https://meta.discourse.org/t/subfolder-sso-login-redirection-issue/110056):
>
> Hi, I have deployed discourse on vm, and configured sso, Also have configured application gateway, we have set a path rule /community for forum, on hitting /community/session/sso the app authorises and redirects back to the main website. For example: on hitting [https://mymainwebsite.com/community/session/sso](https://mymainwebsite.com/community/session/sso) i am automatically redirected back to [https://mymainwebsite.com](https://mymainwebsite.com). When i check the log it has authorised token but at the end it is redirecting to main site. Could anyone pleas…

This has nothing to do with discourse, Check the SSO provider settings, that’s what is supposed to redirect back to the referrer

---

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [February 26, 2019, 9:51am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/3 "2019-02-26T09:51:01Z")

</div>

Hi Thanks for the response @itsbhanusharma . Do we need to add /session/sso somewhere in application gateway configuration? I have added redirect URL something like [https://mydomain.com/community/auth/oidc/callback](https://mydomain.com/community/auth/oidc/callback) in the application configuration.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [February 26, 2019, 10:16am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/4 "2019-02-26T10:16:06Z")

</div>

I don’t know what SSO provider You’re using so maybe consider referring to their documentation on setting the return url

---

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [February 26, 2019, 10:19am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/5 "2019-02-26T10:19:25Z")

</div>

I am using Azure B2C, I have added redirect URL as I mentioned earlier. Do I need to configure/add anything else.

---

<div class="post-metadata">

### Author: ![Muthukkumar](https://avatars.discourse-cdn.com/v4/letter/m/77aa72/32.png) [@Muthukkumar](https://meta.discourse.org/u/Muthukkumar)
#### Post date: [February 28, 2019, 4:35am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/6 "2019-02-28T04:35:47Z")

</div>

Hi This can be fixed in ruby code. Below is the path to modify the code.

path: app/controllers/users/omniauth\_callbacks\_controller.rb

---

<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: [April 3, 2022, 6:13pm UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/7 "2022-04-03T18:13:15Z")

</div>



---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [April 4, 2022, 1:48am UTC](https://meta.discourse.org/t/sso-login-redirection-issue/110103/8 "2022-04-04T01:48:30Z")

</div>


