"Token request failed" error on GitLab Mattermost

Mattermost and Gitlab are latest
Gitlab is port 8181, Mattermost is port 8282, both are https. They are running on same server, Gitlab Omnibus package.
I followed the steps from guide url below


Go to mattermost home page
Add a team name
Click on create
Redirects to gitlab login page
After login it shows "Authorize required, Authorize mattermost to use your account?
I click accept
Redirects to mattermost it shows “GitLab Mattermost needs your help: Token request failed, Go back to team site”

Been stuck now for a few hours, don’t know what issues is. Get this regardless if I use http or https.

Have you gone through the troubleshooting steps for the Token request failed error message?

There’s a link to the guide in the install instructions, but we should probably make it more prominent. It doesn’t solve everything, but it helps to narrow the possible solutions.

Ill read through it.

Looked through it. Everything appears to be fine, addresses, secret, app id all match.

I’ve seen this fail with self-signed certificates because gitlab doesn’t trust the ssl certs presented by mattermost. Search both the gitlab and mattermost logs and I’m sure you’ll find those messages.

Let me try this again, keep trying to reply and it doesn’t post my reply.

We are using a SSL from https://comodosslstore.com the PositiveSSL Wildcard. Been using the SSL with Gitlab for months with no issues. We are trying to get mattermost to run on the same server it’s the Gitlab Omnibus package. mattermost is using the same SSL as Gitlab from same directory.

SSL has working on everything we have tested it with foxfire, chrome, ie, git and more.

We have also run a number of SSL checking tools and it has passed everyone we tried.

Were are mattermost logs located and ill look through them.

Here last few lines in log, from last time I tried to get it to run.

[2016/01/07 21:46:11 EST] [EROR] Couldn’t find team name=signup, err=We couldn’t find the existing team

[2016/01/07 22:30:20 EST] [CRIT] Failed to ping db err:pq: the database system is starting up

[2016/01/07 22:40:02 EST] [EROR] /signup/gitlab/complete:AuthorizeOAuthUser code=500 rid=4rcgfc6ud3g9tccoi89ujc8cow uid= ip=mypersonalip Token request failed [details: Post https://mysite.com:8181/oauth/token: dial tcp serverip:8181: i/o timeout]

[2016/01/07 22:40:11 EST] [EROR] Couldn’t find team name=signup, err=We couldn’t find the existing team

[2016/01/07 22:52:07 EST] [EROR] /signup/gitlab/complete:AuthorizeOAuthUser code=500 rid=hphmah7bii8q3ex599z7awm7ie uid= ip=mypersonalip Token request failed [details: Post https://mysite.com:8181/oauth/token: dial tcp serverip:8181: i/o timeout]

Hi.
I get the same “Token request failed” in Mattermost.
I just install newest version 5.21 (docker from github), and am linking it to GitLab CE 8.16.6 (docker too). The same GitLab, linked to Mattermost 3.7.3 (docker) works fine.
I’m using http (no https yet).
In version 5.21 I can click on button “Sign in with: GitLab” for log in. Then GitLab web page appears, where I log in with GitLab credentials. Then another page appears there I have to Authorize the credentials for Mattermost. But when clicking an Authorize button and after 3-4 second a “Token request failed” error appears every single time.

{"level":"error","ts":1586122232.3910975,"caller":"web/oauth.go:259","msg":"AuthorizeOAuthUser: Token request failed, Post http://server.company.com:10080/oauth/token: dial tcp: i/o timeout"}

I tried a MM versions 5.9 and 4.9 (docker). However, both gave me “Token request failed” response after succesfull GitLab log in (btw, logged in user does not exist in MM yet, as it is a new installation).

Could there really be some very short timeout to get token, or something else can be in question?