Closed MaoX17 closed 4 years ago
Hi,
Below the summary of the issue #30 answer :
Assuming Mattermost configuration in config.json
is valid. When you click on the Gitlab button on the Mattermost login page, you are redirected to the authorize page from the oauth server :
http://<oauth_server>/oauth/authorize.php?response_type=code&client_id=<token_client>&redirect_uri=http://<mattermost_server>/signup/gitlab/complete&state=<state_token>
The error "redirect_uri_mismatch" comes when the redirect_uri
values in the table oauth_clients
, from the oauth database, is not equal to the url parameter redirect_uri
.
For example, if redirect_uri
value in the database is http://<mattermost_hostname>/signup/gitlab/complete
and the url redirect_uri
parameter is http://<mattermost_ip>/signup/gitlab/complete
, you will get the error "redirect_uri_mismatch" because <mattermost_hostname> != <mattermost_ip>
even if this is the same server.
Mattermost builds the redirect_uri
parameters in the URL from the site url
parameter in config.json
. If site url
is set to http://mattermost.company.com:8065
then the redirect_uri
will be http://mattermost.company.com:8065/signup/gitlab/complete
. So if you need to adapt the URL parameter redirect_uri
you need to update your site url
parameter in the Mattermost config.json
file.
Besides, the reference redirect_uri
for the Oauth server is the value in oauth_client
table, which must be equal to the parameter send by Mattermost to allow Oauth authentication. By default, this field is filled by the init shell script, but it is possible to update its value directly in the table.
If you want to adapt the Oauth redirect_uri
value, connect to your Oauth database (MySQL or PostgreSQL) and update the value with the following SQL command :
UPDATE oauth_clients SET redirect_uri = 'http://mattermost.company.com:8065/signup/gitlab/complete' WHERE client_id='<client_id>'
Change mattermost.company.com
with your Mattermost hostname/IP, and
After, you should be able to connect to Mattermost through the oauth server.
Moreover, check your docker-compose values for environment variables. You should to precise these values directly in the docker-compose file or in the .env
file. As stated in the Readme :
Before running the docker-compose file, you need to adapt LDAP and DB parameters. All parameters are gathered in the
env.example
file and they are passed to Postgres and Oauth server by environment variables. Copy the env.example file to .env and edit it to change with your values. For demo, parameters are directly in thedocker-compose.yaml
file, so you need to edit this file instead of.env
.
You should adapt the redirect_uri
parameter in the .env
file with the good value.
I hope these will solve your problem, please give me your feedback,
Regards
Sorry. Ok, it solve the problem. Thank you
I have followed yur guide to install.
I use docker-compose:
version: '3'
services: mattermost-ldap: build: Docker/mattermostldap image: mattermostldap restart: always ports:
with this config in mattermost:
"GitLabSettings": {
Versione Mattermost: 5.27.0 Versione Schema Database: 5.27.0 Database: postgres
When i click on GitLab browser give me the error: