Mattermost, Inc.

How to use generic OAuth2 with Gitlab provider

Hello all,

I use Drupal’s OAuth2 login provider. As far as I can tell, GitLab uses a completely standard OAuth2 implementation.I seem to have made significant headway using GitLab’s SSO for mattermost so far, but am now stuck with the following error:

Bad response from token request

The associated log entry is:

[EROR] /signup/gitlab/complete:AuthorizeOAuthUser code=500 rid=yfd81kqxwqsdf2dfrqfsgy uid= ip=x.x.x.x Bad response from token request [details: ]

I’m not entirely sure how to further debug: Any advice on how to do this? Here are my current settings:

User API Endpoint: https://MYSITE/oauth2/user/profile
Auth Endpoint: https://MYSITE/oauth2/authorize
Token Endpoint: https://MYSITE/oauth2/token

I’m actually not sure how to test to see what the sequence is or what output is coming. I’ve set the log output to debug, but it’s only as above.

Any ideas or hints?

Hi Tarek,

Generic OAuth isn’t supported. You can test if GitLab SSO is working by setting up an account on GitLab.com and checking to see if that SSO works?

1 Like

I know that Generic OAuth isn’t supported. However, as far as I can tell, GitLab uses a completely generic OAuth2 implementation, and I saw some references to “unsupported use” of GitLab as being possible.

I have signed up for a GitLab account to see if it works, but I expect no issues there.

I am very happy to make some changes to the GitLab module, but am not entirely sure how to debug the calls MM is making.