User cannot connect to mattermost with gitlab

User cannot connect to mattermost with gitlab

I am contacting you for a problem that one of our users is currently encountering precisely he cannot connect to mattermot on the other hand he connects well to gitlab and normally each user (ldap account) who manages to connect to gitlab he must have the same for mattermost

just for information I have made requests and I found that the user does exist in the database gitlab (gitlabha-production) and this is normal

but it is not present in the mattermost database

so when he wants to authenticate himself through gitlab he has the following error message

there is already an account associated with this email address using a login method other than gitlab, please login using emailisn’t normal)

Mattermost Version: 5.31.1

Database Schema Version: 5.30.0

Database: postgres

Gitlab-ee 13.9.7

Thank you in advance

I got a few of these errors when I migrated my users to Keycloak a while ago. But the error was always correct, there was indeed a user with the same email address.

How did you check the database?
Something like the below?

Select username, email from users;

Hello tomz,

I checked the database we go through the following request:
select * from users where username = ‘’ ldap of the user ';

and as a result no user with (ldap of user) exists on the database mattermost

on the other hand when I pass the following request:
select * from users where email = ‘salome.xxxx@xxxxx.com’;

I find the concerned user but with another username (salome_lastname) the thing that is not normal I have to find his ldap

Do you think that we have to delete the user from the mattermost database and ask him to reconnect himself again we go through gitlab
Thanks for your feedback

Thank you for your help

That’s exactly what I had to do, I migrated users from local to in my case Keycloak.
If you want to keep the old account you could change the email address of user salome to something different?
What I ended up doing was the following:

  1. Rename email address of local user to avoid the “duplicate” error
  2. Sign on with Ldap/Keycloak
  3. Update the original user with the LDAP/Keycloak info
  4. Delete the new LDAP user

That way I was able to keep the history of the local user with the logon switched over to Keycloak.
If I remember correctly the fields which define how a user logs on is in the authdata and authservice fields in the users table.