Transforming usernames with SSO

Our team’s Discourse forum uses SSO. Sometimes, users have aliased accounts that read as, and so in Discourse the username appears as john_smith_lab.

It’s a bit awkward to have so many usernames that are inconsistent with these aliases (we have a lot of different ones), so we were trying to figure out if there’s a way to alter/transform these usernames before or when they’re created in Discourse.

For example, since we do all our aliases with the + symbol, if there’s a way to truncate everyone’s username from the + onward, then that would allow us to normalize everyone’s username to a first_last state.

Is this something that’s possible? If so, how would we go about doing it?


I think the solution is to configure your SSO so that it sends a reasonable username. Aren’t those usernames that you don’t like sent to Discourse by your SSO? Also, if sso overrides username is un-checked, then users can change their username (within some limits that are configurable).


If we uncheck sso overrides username, are the username change limitations referring to things like min/max length and allowed unicode characters? I see those, but I want to make sure I’m not missing other major configuration options.

You shouldn’t change any settings from default and send the appropriate username in the SSO payload. Our Official Single-Sign-On for Discourse (sso) topic covers that.


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