In a discussion titled “Discourse-saml + Okta endless redirect” under the SSO category, runofthemill reports being stuck in a redirect loop between their Discourse forum and Okta after enabling SAML SSO. After sharing screenshots of their Okta, Discourse, and app.yml configurations, they receive help from skoota, who suggests disabling all custom SSO settings in Discourse since the plugin handles SSO. This resolves the redirect loop, but introduces a new issue: incorrect or invalid email values during user registration. runofthemill discovers the email attribute from Okta is returning an array, not a string, and patches the plugin’s plugin.rb to extract the first value using .try(:first)runofthemill. Later, neil suggests this could have been resolved in Okta’s SAML app settings by mapping the correct attribute (e.g., screenName as email), which runofthemill acknowledges but notes the forum is no longer active. The thread highlights common SAML integration pitfalls and workarounds for attribute mapping and data type handling.
Hi there - I’m trying to get the discourse-saml plugin working with Okta; I’ve scoured the existing threads, and can’t seem to figure out what’s going on.
When I go to the login page, it prompts me to log in with my Okta credentials. Upon logging in, the page gets stuck in a loop between forums.trusa.io (the Discourse URL) and teamrubiconusa.okta.com (the Okta login).
Happy to help, as it took me a while getting this working too
I think the issue could be the SSO configuration in the Discourse settings - remove all the custom configuration for SSO that you have made, as SSO is being handled by the plugin instead. This is what mine looks like:
Thanks! That seems to fix the problem, although now it’s pulling in the wrong data for user email when a new user registers, and it won’t let the registration complete since there’s an invalid value in the email field, which isn’t editable :\
I appreciate the help! Trying to debug the email issue now, will post back with any updates.
So it’s now pulling in the correct data for the email field, but gives “Something went wrong” when the user proceeds to create a new account.
The logs show an error with "Undefined method 'strip' in /app/controllers/users_controller" at line 311, and I think it’s because strip expects a string, and it’s getting an object. But if I add .to_s to result.email = auth.extra[:raw_info].attributes['screenName'], the new user’s email shows up as ["jeremy.miller+test@teamrubiconusa.org"] so that’s not quite the right solution…
I’m not a Ruby or Rails developer, so I’m not sure the correct way to handle this; any thoughts?
Sorry for reviving an old topic… @runofthemill Isn’t this something that could have been fixed in the SAML application settings in Okta? Seems like Screen Name has email as the value.