Forum Discussion
Get refresh token of Teams Desktop of the current user
The Teams client must store access and refresh tokens somewhere (probably encrypted in the local or session storage of the underlying browser)
I am wondering, if there is a way to read those tokens, especially the refresh token that Teams uses to call its Apis in the background.
If I open the Teams developer tools, I can not find the token in any of the requests.
And Fiddler seems to block Teams and there is no easy way to sniff the traffic produced by the client- do you have any other idea?
Why do I need this?
I need this token to write a script that uses the unofficial Teams api (not the graph).
I want to use this API to create a link to a certain SharePoint library in all my Teams (it used to be called "Add cloud storage")
This option is not available in the Graph and therefore I have to use the unofficial Teams Api to create those references programmatically.
Getting a token for it (via authorization code flow) seems only possible with the Teams client itself.
8 Replies
Hi David_Elsner,
Do you want to add a new tab for all your teams or add an option on a specific location?
- Nivedipa-MSFT
Microsoft
@David_Elsner - We got a reply from engineering team saying that the refresh token is handled by MSAL and it’s not a good practice for an app to try and extract it out of LocalStorage and even a worse practice to expose it in such a way that it can be extracted/copied out of our domain.
The way you want to implement has security concerns.
Teams network traffic can definitely be viewed using Fiddler or the browser DevTools. We have documentation on that here:
https://learn.microsoft.com/en-us/azure/azure-web-pubsub/howto-troubleshoot-network-trace
When using Fiddler, you might need to restart Teams after launching Fiddler so that it gets correctly set as the proxy. But opening Teams on the browser and using the network tab of the DevTools is even easier.Thanks,
Nivedipa
------------------------------------------------------------------------------------------
If the response is helpful, please click "**Mark as Best Response**" and like it. You can share your feedback via Microsoft Teams Developer Feedback link. Click here to escalate.
- Nivedipa-MSFT
Microsoft
David_Elsner - Could you please share your valuable feedback via Microsoft Teams Developer Feedback link.
- Nivedipa-MSFT
Microsoft
David_Elsner - Thanks for reporting your issue. We will check and share the updates with you.
- David_ElsnerBrass Contributor
Nivedipa-MSFT Thanks - any help is highly appreciated.
- Nivedipa-MSFT
Microsoft
David_Elsner - We are checking this with engineering team, we will let you know once we get any updates from them.