Storing persistent data associated to Teams user

Copper Contributor

I am developing a Teams Tab App where the user needs to authenticate using an external API which sends back a token. As the tab is reloaded everytime it is exited and entered again, the user would need to authenticate again. I would like to store this token somewhere. localStorage is an option, but it would be even better if I could store this token in some kind of storage associated to the Teams user using the app, so, for example, it does not need to relogin when switching from Team in web to Team standalone app.


For this, and for other use cases, I would like to know whether it is possible to store data associated to the Teams account that is using the app, so it can be later retrieved (something like a localStorage but associated to the account).


I have already had a look at this thread but I don't see how getContext (as the answer says) can help me with my task. An explanation on this if it's possible will also help.


Thank you

5 Replies
@Peaverin-Thanks for reporting your issue.
We will investigation this issue and get back to you.

@Peaverin -With SSO in Teams, app users have the advantage of using Teams to access apps. After logging into Teams using Microsoft or Microsoft 365 account, app users can use your app without needing to sign in again. Your app is available to app users on any device with access granted through Azure AD.

Reference Document-Overview to authentication for tabs using SSO in Teams with Azure AD - Teams | Microsoft Learn
Sample Link-Microsoft-Teams-Samples/samples at main · OfficeDev/Microsoft-Teams-Samples (

I have the same problem to store session dependent data e.g. in a cookie. In a MS-Teams APP I get the UserID via a URL parameter. Based on this, it would be possible to store user-dependent data. However, all other calls to the APP unfortunately have no more user-related references, so it is not possible to access stored data. The TeamJS SDK offers the possibility to retrieve the data via getContent() but my question would be how to get this content information into my server side backend code. My webpage is a .CSHTML page with RAZOR. the backend code is provided via the appropriate controller in CS.

Would this way be possible or is there an example where I can see this. I would be grateful for any help.

About SSO I actually did not want to go because I currently do not need resources from MS Azure.

Thanks a lot Mike
Hello @Mikel85570, @Peaverin - Sorry for delay in response.
Could you please confirm whether your issue has resolved or still looking for any further help here?
Hello @ChetanSharma-msft,

I lacked the exact understanding about working with SSO.
helped me hit the following article:

Thanks Mike