How to remove local storage data after uninstallation of the teams custom tab app from teams store

Raghavendra Reddy 0 Reputation points

I made an teams custom tab application which stores login user token in local storage But it stores the user token even after uninstalling the application. when I uninstall the app and then reinstall it, the session remains in local storage, allowing the user to go to the home page without going through the login screen. Can you please tell me if there is a way to achieve this

thank you.

Microsoft Teams
Microsoft Teams
A Microsoft customizable chat-based workspace.
8,716 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,741 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andrew Dello Stritto 85 Reputation points Microsoft Vendor

    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:

    1. 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.
    2. 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.
    3. 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.
    4. 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.

    0 comments No comments