OfficeDev / microsoft-teams-library-js

JavaScript library for use by Microsoft Teams apps
https://docs.microsoft.com/microsoftteams/platform/
Other
434 stars 198 forks source link

authentication.getAuthToken() on Teams web client return token after few seconds #2603

Open vbatr opened 2 weeks ago

vbatr commented 2 weeks ago

Hi,

I am calling microsoftTeams.authentication.getAuthToken() to get Tab SSO token. And everything works fine on Teams web and desktop clients. When the same code is executed in Teams mobile app it is taking few seconds (1 - 30 seconds) to get the token, that is slowing down the app performance a lot

const start = performance.now();
const token = await microsoftTeams.authentication.getAuthToken({ silent: true });
const end = performance.now();
console.log(`Execution time: ${end - start} ms`);

msteams-js library 2.17.0 - 2.30.0

Regards, Volodymyr B.

sayali-MSFT commented 2 weeks ago

Thank you for your inquiry about your Teams app development issue! To assist you better, could you please provide the following details? Please share the steps you took to encounter the issue. This information will help us better understand the situation and provide a more accurate response.

Thank you!

vbatr commented 2 weeks ago

Hi @sayali-MSFT

To reproduce an issue we can take the examples like https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/tab-personal-sso-quickstart/csharp_dotnetcore/wwwroot/js/auth.js#L41 or https://github.com/OfficeDev/Microsoft-Teams-Samples/blob/main/samples/tab-personal-sso-quickstart/js/src/components/Tab.js#L46 update msteams-js to one of the latest version (i.e. 2.30.0 ) and open tab in Teams mobile (iOS or Android).

getAuthToken() will return the token in few seconds that is affecting the performance of the app

Regards, Volodymyr B.

sayali-MSFT commented 1 week ago

Hello @vbat, Thank you for your patience! We were able to reproduce the issue in the Mobile (iOS) Teams version [6.19.77.2024193602/1022]. We have reported this as a bug for further investigation.

We will keep you updated as soon as we receive further information. Thank you for bringing this to our attention!