"Team Not Found" when using Mattermost as Oauth2.0 Service Provider


My team is using Mattermost as an OAuth2.0 Service Provider in an Angular webapp. The Mattermost instance is configured to use both a username/password login and a Google SSO login.

During the OAuth2.0 login process, the users logging in with Google are logged in correctly, and redirected correctly to the Angular app. Users logging in with username/password, however, are met with a “Team not found” error (see screenshot).

When following the Back link, the user is logged in but redirected to Mattermost, not the OAuth2.0 redirect url.

I have been unable to find out what could cause the difference in behaviour between Google and password login.

Thank you in advance for your help

Hello, @ytroude

May I know if you see any errors in the mattermost.log as well as the JS console in the developer tools that we can tie back to error that we are seeing when you reproduced the issue?

Additionally, do you use default teams feature in your Mattermost instance?

I can’t see any error in the log and we do not use the default teams feature.

However, the JS console has an error I didn’t see before due to having “Preserve Logs” unchecked :

main.23eccd40255a70458645.js:763 GET https://.com/communication-center/api/v4/teams/name/communication-center 404 (Not Found)

It seems Mattermost views the path at which the Mattermost instance is hosted (/communication-center) as a team name.

Any new on this topic @ytroude @ahmaddanial ? All our environements (including production) have this bug.

As a complement, this is only happening when I connect with a GUEST account and that should be noted to reproduce this bug.

adding @stu.doherty to this thread, we cannot check the mattermost code since this code is in entreprise part.