Would this be what you’re looking for https://docs.mattermost.com/developer/oauth-2-0-applications.html?