OpenID Login – Username Format Issue

Hello,

I have a quick technical question regarding the usernames assigned to members logging in via OpenID.

Currently, when a user logs in, their username is automatically set to the first part of their email address (e.g., morit_z@domain.com results in the username morit_z). However, we would prefer the username to reflect the user’s full name (e.g., Max Mustermann), as stored in their profile.

Do you have any idea what might be causing this behavior? Is there a configuration setting we’re missing, or could this be an issue with how the user data is being transmitted via OpenID?

Thanks in advance for your help!

This is how the username looks like

image

These are the infos that are comming from easyVerein (this is not the same mail I used for the first picture)

Many thanks

I think it is because easyVerein’s username looks like this:

{

“username”: “FREILab_<MY_MAIL>.de”,

}

If it would be a normal name it should be right e.g. Max Mustermann?! But anyway mattermost is not correctly parsing this username, why is this? I am getting the feeling this is a mattermost bug, or am I wrong?

Thanks for sharing the details! Mattermost uses the username field from the OpenID Connect (OIDC) payload to populate the Mattermost username on first login. In your case, since EasyVerein is passing an email-style string as the username (e.g. "TSimon_sb@software-design.de"), Mattermost uses that as-is, which explains the format you’re seeing.

If you’d prefer the full name (e.g. “Max Mustermann”) to be used instead, EasyVerein would need to send the desired name as the username claim in the OIDC token. Mattermost doesn’t automatically fall back to the name field when username is present.

You can find more on how Mattermost handles OIDC attributes here: OpenID Connect Single Sign-On - Mattermost documentation

Mattermost uses the username from OIDC, so it shows the email you get. To use full names, EasyVerein must send the full name as the username.

1 Like

Sorry, but that’s not correct. You’re using the mail attribute, and extracting everything before the @ from it. We tested this with Authentik, and we’re now remapping it accordingly than. Thanks anyway! :smiley:
One more thing.
If you, for example, log in with max@test.de and later with max@test123.de, the user max@test.de gets overwritten by max@test123.de. This is definitely not the behavior Mattermost intends for its users, right?
So in our case. It is actually not working. Is this something you can fix? Since we have a Pro licence we can not do it on our own.

I opened a bug report since I am getting no reply. See link here

1 Like