SSO Login redirection issue

AI-generated summary

SSO Login Redirection Issue Summary

Muthukkumar is experiencing an issue where after configuring SSO and Application Gateway, the login redirection redirects back to the main website instead of the Discourse forum. He has checked the logs and confirmed authorization, but still faces the issue.

itsbhanusharma pointed out that this is a duplicate of a previous issue and that it’s not related to Discourse, but rather the SSO provider settings. He suggested checking the SSO provider settings to redirect back to the referrer.

Muthukkumar asked if he needs to add /session/sso to the Application Gateway configuration, and itsbhanusharma recommended referring to the SSO provider’s documentation for setting the return URL.

Muthukkumar confirmed that he’s using Azure B2C and has added the redirect URL, but still needs help with configuration. He eventually found a solution by modifying the Ruby code in app/controllers/users/omniauth_callbacks_controller.rb Muthukkumar.

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 i am automatically redirected back to https://mymainwebsite.com.
When i check the log it has authorised token but at the end it is redirecting to main site.

Duplicate of

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

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 in the application configuration.

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

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

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

path: app/controllers/users/omniauth_callbacks_controller.rb