"The redirect URI is not valid" during OAuth on on new Gitlab v8.2.2 omnibus installation

I recently installed GitLab v8.2.2 on a new server using the omnibus package. Today, I decided
to enable the Mattermost service to try it out. I configured it on its
own vhost, e.g. https://chat.mydomain.com, while GitLab runs on https://gitlab.mydomain.com.

I have an Apache reverse proxy set up that allows SSL external access
to each vhost appropriately. My Apache instance communicates directly
with Mattermost on its HTTP port 8065 (the included nginx reverse proxy
is disabled in my gitlab.rb file using mattermost_nginx[‘enable’] = false). My Apache configuration is similar to that shown in the responses shown at this previously-reported issue.

I can access each vhost as expected. When I connect to the Mattermost
host (I’m already logged into GitLab), I get a prompt to create a team.
When I enter a team name, I’m forwarded over to GitLab for OAuth
authorization, who reports the error message:

The redirect URI included is not valid.

I don’t see any relevant error messages in any logs. For what it’s worth, the redirect_uri specified in the OAuth HTTP request is https://chat.mydomain.com/signup/gitlab/complete,
which looks correct. That URI is accessible from a shell on the GitLab
server, although I get a 500 HTTP error when I try to retrieve it using wget (I assume it’s looking for some state that I’m not passing it).

I’ve seen others who have reported the same error message (such as this previous question, but no real steps to take to resolve the problem. Any ideas?

I have updated to v8.3.2 to see if the above behavior changed at all, but it still reports the same error. Any ideas on how I can at least debug this further (e.g. logs to look at)? GitLab isn’t giving any indication why the redirect URI is invalid.

I just figured it out! I noticed under GitLab’s Settings -> Applications -> GitLab Mattermost, it had an OAuth callback URL that wasn’t correct (it had the wrong external base URL in it, probably from an earlier time when I was trying to configure Mattermost properly). I corrected it to the proper callback URL and things are up and running.

I would think that GitLab should set this value up automatically if I update the Mattermost external_url in gitlab.rb and then do a gitlab-ctl reconfigure, but I may be mistaken.

1 Like