# Migrate all users from email to GitLab SSO as sysadmin

**URL:** <https://forum.mattermost.com/t/migrate-all-users-from-email-to-gitlab-sso-as-sysadmin/10696>\
**Category:** Troubleshooting\
**Created:** [November 5, 2020, 6:24pm UTC](https://forum.mattermost.com/t/migrate-all-users-from-email-to-gitlab-sso-as-sysadmin/10696 "2020-11-05T18:24:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emiltorp](https://avatars.discourse-cdn.com/v4/letter/e/ee7513/32.png) [@emiltorp](https://forum.mattermost.com/u/emiltorp)\
**Post date:** [November 5, 2020, 6:24pm UTC](https://forum.mattermost.com/t/migrate-all-users-from-email-to-gitlab-sso-as-sysadmin/10696/1 "2020-11-05T18:24:39Z")

</div>

We have had a Mattermost server running for a couple of years, and a lot of our users have created an account with their email, as that was all we had available. Now we have the ability to use GitLab authentication and we want to migrate all users to that solution to be able to use SSO and a single password for multiple services.

I first saw this feature in the mattermost, and thought it was perfect:

```auto
mattermost user migrate_auth {from_auth} {to_auth} {match_field}

```

> **[Command Line Tools — Mattermost 5.28 documentation](https://docs.mattermost.com/administration/command-line-tools.html#mattermost-user-migrate-auth)**

Well, that didn’t work because Mattermost has not built support for migrating `to_auth = gitlab`. Gitlab is only supported as `from_auth`.

So my next thought was using the Mattermost API to first change the password to a temporary one

```auto
https://your-mattermost-url.com/api/v4/users/{user_id}/password

```

followed by using this to change the authentication method:

```auto
https://your-mattermost-url.com/api/v4/users/login/switch

```

> **[Mattermost API Reference](https://api.mattermost.com/#tag/users/paths/~1users~1%7Buser_id%7D~1auth/put)**

However, that gives you a follow-link that need to authenticate with the new method. So I can’t script it and do it for all users.

So, how do I change all users at once to GitLab auth?

---

<div class="post-metadata">

**Author:** ![XxLilBoPeepsxX](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/xxlilbopeepsxx/32/4993_2.png) [@XxLilBoPeepsxX](https://forum.mattermost.com/u/XxLilBoPeepsxX)\
**Post date:** [November 7, 2020, 5:00am UTC](https://forum.mattermost.com/t/migrate-all-users-from-email-to-gitlab-sso-as-sysadmin/10696/2 "2020-11-07T05:00:55Z")

</div>

If you have the user’s all become required to sign in using GitLab, that may be an option to force your users to create/link their accounts with GitLab and skip migrating entirely. User signup can still be restricted to a specific email domain, of course.

---

<div class="post-metadata">

**Author:** ![daddydayz](https://avatars.discourse-cdn.com/v4/letter/d/8797f3/32.png) [@daddydayz](https://forum.mattermost.com/u/daddydayz)\
**Post date:** [January 17, 2025, 2:47pm UTC](https://forum.mattermost.com/t/migrate-all-users-from-email-to-gitlab-sso-as-sysadmin/10696/3 "2025-01-17T14:47:20Z")

</div>

did you happen to figure this out?
