Overview
When running M-Files Server older than 23.1.12167.0 and using the Teams add-in with federated authentication, you may run into a situation, where the initial login works, but after some idle time, the add-in logs you out and when you try to log in, you get an error saying "The JWT token did not pass validation", as show below:
Details
This situation happens if the Teams add-in has problems refreshing the authentication token from the Identity Provider. In the context of the MS Teams app, it is MS Teams that provides the authorization/access tokens from its own local storage, and sometimes it provides an old (cached, expired) token.
Solution
To solve this issue, update your M-Files Server to version 23.1.12196.5 (January 2023) or newer.
Workaround
If you cannot update your server for some reason, then you can work around this issue by raising the Client Session Timeout limit in the add-in's settings in M-Files Admin. Set the value to 86400 seconds (24 hours), for example, as shown below:
This extends the period of time during which the add-in does not poll the Identity Provider for a refresh token, thus avoiding the error. If a user logs out from Teams daily (for example, shuts down their workstation for the night), then this should help to completely avoid the error situation.
