How to clean the new Microsoft Teams for MacOS

Teams for MacOS has multiple severe bugs with authentication, especially with identity providers like Google Workspace. If it breaks it can lead to situations, where after the Google login it degrades to an error 2002 that cannot be solved straightforward.

Teams stores more than 20-30 keychain entries in addition to having local filesystem state, all these items need to go in order to completely reset it and allow logins again.

Also please not that typically all the links within the MacOS teams app to logout or report any issues simply do not work and are broken. Also there are no good official Microsoft cleanup docs and official instructions on how to re-install it are incomplete and do not clean all of the state.

If you find some good way to automate all of this, I would be happy to contribute and publish. If anyone from Microsoft reads this: please fix the authentication component to not store persistent state this way. Logins and all app functionality should always be correct without any kind of regular cleanups.

Instructions

1. quit teams

2. delete the new teams folder

Press Cmd + Space and enter "Terminal" and then open Terminal.app

rm -rf ~/Library/Group\ Containers/UBF8T346G9.com.microsoft.teams
rm -rf Library/Containers/com.microsoft.teams2

3. start keychain access to delete all the keychain entries (many)

Start keychain access by pressing Cmd + Space and then enter "keychain access" and start the app

If you want to make sure you delete the right things: for all keychain deletes you can check if this originates from com.microsoft.identity by opening the keychain item and checking under the "Access Control" tab.

If an item does not want to be deleted, please make sure that the keychain you select in the left-side menu matches the one the item is stored into (visible in the right-most column), otherwise keychain access will not delete the item, or show it not deleted although it already has been deleted.

Sometimes keychain access shows items that have already been deleted, try to restart it if that happens.

search for the following strings and delete whatever you find (do this separately for both the login and iCloud keychains):