When you uninstall an application, the application's local storage is typically not removed, so any data stored in local storage will still be there after the application is reinstalled.
To address this issue, there are a few different approaches you can take:
- When the user logs out of the application, you can clear the local storage. This way, when the user uninstalls and reinstalls the application, the login token will no longer be present in local storage and the user will need to log in again.
- Before the user logs in, you can check if there is any login token in the local storage. If there is a token present, you can check if it is still valid. If it is not valid, you can clear the local storage and ask the user to log in again.
- You can store the token on the server-side and use it to authenticate the user upon login, this way you can easily revoke the token when the user uninstalls the app or you can set the token to be expired after a certain period of time.
- You can use the Microsoft Teams API for authentication, it allows you to authenticate the user using Microsoft Teams identity, and it automatically handles the token management for you.
Please keep in mind that storing the user token in local storage is not a secure way to handle user authentication, you should use a secure and a proper way to handle user authentication like OAuth2 or OpenID Connect to authenticate your users and store the token securely in a server-side database.