Crivaledaz / Mattermost-LDAP

This module provides an external LDAP authentication in Mattermost for the Team Edition (free).
MIT License
359 stars 71 forks source link

POST /oauth/token returns 404 #114

Closed Acsigen closed 8 months ago

Acsigen commented 8 months ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Mattermost login page'
  2. Click on 'Gitlab'
  3. Authenticate with proper LDAP credentials
  4. See error: image

Expected behavior I should be able to login to Mattermost platform

Project (please complete the following information):

Additional context The NGINX has the following log message: 172.19.0.2 - - [13/Feb/2024:16:55:49 +0000] "POST /oauth/token HTTP/1.1" 404 153 "-" "Mattermost-Bot/1.1" "10.22.12.22"

I am running Mattermost and Mattermost-LDAP behind Traefik proxy. I configured NGINX to only use http in the backend because Traefik is already upgrading the connection to https.

Mattermost-LDAP is connecting via HTTPS to the Mattermost instance.

The LDAP login page works just fine: image

Acsigen commented 8 months ago

Update:

I made a change to the nginx configuration to add /oauth/token path. It now passses the /oauth/token error but I receive 404 for /api/v4/user

172.19.0.2 - - [14/Feb/2024:09:32:48 +0000] "POST /oauth/token HTTP/1.1" 200 183 "-" "Mattermost-Bot/1.1" "10.22.12.22"
172.19.0.2 - - [14/Feb/2024:09:32:48 +0000] "GET /api/v4/user HTTP/1.1" 404 153 "-" "Mattermost-Bot/1.1" "10.22.12.22"
Acsigen commented 8 months ago

Fixed after analysing #113. My Gitlab Endpoints were not editable from the Mattermost interface and had different path. I had to add the following lines in oauth.conf in order to have the proper path so it matches the ones in Mattermost Gitlab plugin configuration page:

location /oauth/token {
   try_files $uri /oauth/token.php$is_args$args;
}

location /api/v4/user {
    try_files $uri /oauth/resource.php$is_args$args;
}