Mattermost, Inc.

Unable to login via Gitlab after 3.0 upgrade

I just upgraded a small instance with 3 teams from 2.x to 3.0.2. The instance has email signups and logins disabled, but has a Gitlab integration so that all users could login using their respective Gitlab accounts.

After the upgrade, after clicking on the “login with Gitlab” button, all I get is this message:

An existing user is already attached to your gitlab account

Where do I even go from here? Of course there is an existing user using my Gitlab account, that’s what I’m trying to login to! There doesn’t seem to be any useful info in the logs nor is there anywhere to go from that message. Since none of the original accounts even had passwords (since they were Gitlab logins) I don’t want to make everybody reset passwords and manage them separately from Gitlab. How can I get these wired up again so they can login?

I swear Google hadn’t indexed this yesterday, but I now get a search hit for that error message on this Github issue report. Is there seriously no way to fix this other than hacking on the database manually?

Hi @alerque, appreciate your bringing this up, agree we need to look into this,

Hi @alerque could you please share your logs around the time you saw the error?

Apache log:

<ip> - - [26/May/2016:05:38:21 +0000] "GET /api/v3/oauth/gitlab/login HTTP/1.1" 302 381 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0"                   
<ip> - - [26/May/2016:05:38:22 +0000] "GET /signup/gitlab/complete?code=****************************************************************&state=**********************************************************************************************************************%3D%3D HTTP/1.1" 307 241 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0"                                                                                       
<ip> - - [26/May/2016:05:38:23 +0000] "GET /error?title=Mattermost+needs+your+help%3A&message=An+existing+user+is+already+attached+to+your+gitlab+account&details=email%3Dcaleb%40alerque.com&link=%2F&linkmessage=Go+back+to+Mattermost HTTP/1.1" 304 - "-" "Mozilla/5.0 (X11; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0"

Mattermost log:

[2016/05/26 05:38:22 UTC] [EROR] /signup/gitlab/complete:CreateOAuthUser code=500 rid=************************** uid= ip=<ip> An existing user is already attached to your gitlab acc
ount [details: email=caleb@alerque.com]
[2016/05/26 05:38:52 UTC] [EROR] /**************************:incomingWebhook code=500 rid=************************** uid= ip=<ip> No text specified [details: ]
[2016/05/26 05:38:52 UTC] [EROR] /error: code=404 ip=<ip>
[2016/05/26 05:38:52 UTC] [EROR] /error: code=404 ip=<ip>
[2016/05/26 05:38:52 UTC] [EROR] /error: code=404 ip=<ip>
[2016/05/26 05:38:52 UTC] [EROR] /error: code=404 ip=<ip>

This 404 message in happening after every request and is likely not related to the login issue.

I redacted the IP (which is the server’s real IP in all instances) and various tokens (none of which were the same as each other) mostly because I wasn’t sure if any of them were sensitive.

Anything else?

Thanks @alerque, we’re investigating a specific corner case that might be causing this, would you know if the account that’s causing the error has been assigned a Team Admin role (i.e. has that role specifically and is not a System Administrator?)

The main account I was testing with was my own, which is the system administrator account.

Thanks @alerque, we’re looking into the issue with upgrading.

It looks like your account has been switched to email sign in. You should be able to recover your account by doing the following:

  1. Go to Mattermost home page
  2. Reset password for the email associated with your GitLab account
  3. Sign in
  4. Go to Account Settings > Security > Sign-in Method and switch your account back to GitLab sign in

@alerque

Did you receive an email from Mattermost about YOUR DUPLICATE ACCOUNTS HAVE BEEN UPDATED?

Would you mind running these sql queries so we can see the user mappings? You can obfuscate/truncate the data.

SELECT Id, Username, Email, AuthData, AuthService FROM Users where Email = 'username@example.com';
SELECT  Id, Username, Email, AuthData, AuthService FROM Users WHERE Username = 'username';
SELECT  Id, Username, Email, AuthData, AuthService FROM Users WHERE Email LIKE '%username%';

Would you mind searching your log files for a line like the following? maybe greping for your email?

modified user_id=xxxx, changed email from=user@example.com to=user+team@examplecom, changed username from=user to user+team changed roles from= to=

@alerque
Did you find a solution to your problems. I think that I’m facing the same situation after Mattermost 3.0 Upgrade.
I was able to restore my password and then login in using user and password, but now according to @lfbrock if I want to switch my account back to Gitlab I’m unable because under Sign-in Method there is no gitlab option.

Do you have any news about this issue?

Thanks in advance.

Sort of. Since it turns out only my account was affected let it go for a long time hoping better user management would show up in the next version or something. I recently broke down and hacked the user table myself from MySQL. I added AuthService='gitlab' and AuthData='X' where X is Gitlab’s internal user ID number for me to my line in the users table and was able to get in that way.