Mattermost, Inc.

[SOLVED] Setting up GitLab + Mattermost on separate proxied containers

Hello everyone.
I’m trying to set up a Mattermost server that is integrated with a separate GitLab server (primarily for leveraging the 2FA support in GitLab). Both services are running on separate containers. Each service is proxied through by an Nginx running on the host, which also manages the TLS certificates (letsencrypt, residing on the host).

I followed the instructions here:
https://docs.mattermost.com/deployment/sso-gitlab.html?highlight=gitlab

Which seem to have worked successfully on Mattermost’s end. However, after clicking on the oauth/gitlab/login button that appears after a restart, I’m redirected to a page that informs me that "The redirect URI included is not valid."
As a matter of fact, the redirect_uri parameter in the URL is “redirect_uri=%2Fsignup%2Fgitlab%2Fcomplete”.

I have tried to add the URL of the Mattermost instance to the gitlab.rb file in the two available options, but I’m afraid those are not helping and they seem specific to GitLab Mattermost only.

At this point I’m pretty much stuck. Even if I manually fix the redirect_uri value in the URL just for testing, I’m redirected back to the Mattermost instance which instead says “Error - Bad token type”.

Any help is very much appreciated.

1 Like

It might be because it seems that even after you run gitlab-ctl reconfigure, the URI is not updated automatically, so you have to manually re-authorize Mattermost using these instructions: https://docs.gitlab.com/omnibus/gitlab-mattermost/README.html#authorise-gitlab-mattermost

You can find more info about the set up here: https://mattermost.atlassian.net/browse/PLT-4078?focusedCommentId=35670&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-35670

Correct me if I’m wrong, but it appears to me that those instructions are for a GitLab Mattermost setup, while I’m trying to use a Mattermost with GitLab SSO.

I decided to try with Gitlab Mattermost instead, and that raised other issues. I’ll open a new thread. Thanks.