Open
Description
Hi all,
I'm building a tab app and am trying to authenticate using '@microsoft/teams-js' like so:
const init = async (): Promise<void> => {
console.log('Initializing MSFT client...')
await microsoftTeams.app.initialize()
setIsInitialized(true)
console.log('MSFT client initialized')
const authToken = await microsoftTeams.authentication.getAuthToken()
console.log('MSFT auth token:', authToken)
}
I'm testing my app in the desktop client but my app is timing out when trying to call microsoftTeams.app.initialize().
I'm having to try and use this new flow as MSAL popups seem to be blocked in the desktop version of Teams. If that's not the case please let me know so I can avoid this headache 😄
As it stands, this times out every single time - am I missing something?
Using: microsoft/teams-js v2.35.0
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Prasad-MSFT commentedon Mar 31, 2025
Hi @DanielCutter thanks for raising your issue. Does the SDK initialization time out in Teams authentication popup? Is it working in Teams web?
DanielCutter commentedon Mar 31, 2025
Hi @Prasad-MSFT sorry for deleting the other message - I've just ran it in the web version of teams with verbose logs enabled and I get the same error:
Uncaught (in promise) Error: SDK initialization timed out.
In neither the web app or the desktop app is a popup being rendered.
Here are the additional verbose logs:
DanielCutter commentedon Mar 31, 2025
My Teams App is just an iframe pointing to my hosted website. Is that causing the issue perhaps?
Prasad-MSFT commentedon Apr 1, 2025
Hi @DanielCutter, could you please check the manifest for your Teams app to ensure that the correct
validDomains
are specified?This ensures the app recognizes the iframe's domain.There is one way that apps could fail on init timeout issue, which is that app is not hosted in host. For example, if you are on Teams in edge and your app is loaded, and then you click those three dots on top right of your app and then select Go to Website, the app will try to be loaded in a new web page/tab. Then, since app is not hosted in host (it's not in an iframe), i.e. Teams, it will cause init timeout issue. Though based on your description, your problem might don't fall into this scenario.
Could you please also refer this thread and check the suggestions provided?
DanielCutter commentedon Apr 1, 2025
Hi @Prasad-MSFT I'm trying to run this locally with two setups:
1.
2.
Here is my manifest,json validDomains:
With either configuration I'm still getting timeout issues.
I looked at the thread you linked and no solutions worked for me.
Prasad-MSFT commentedon Apr 1, 2025
Okay @DanielCutter, as we are having trouble repro'ing this issue at our end, could you please help providing a repro video along with the deployed app manifest (if possible) so that it would be easier for us to check and raise a bug if required?
DanielCutter commentedon Apr 1, 2025
Thanks @Prasad-MSFT Here's a video run through, let me know if you need anything else, appreciate your time.
https://www.youtube.com/watch?v=MQ2e1neI_TE
Deployed manifest.json in app developer portal
Prasad-MSFT commentedon Apr 2, 2025
We have raised a bug for the same. We will inform you once we get any further update from engineering team. Thanks!
DanielCutter commentedon Apr 2, 2025
Thanks @Prasad-MSFT ! Is there any rough time estimate on when the team will be picking up this bug? Only this is blocking me from releasing my app to the microsoft teams app marketplace.
Prasad-MSFT commentedon Apr 2, 2025
Apologies @DanielCutter , we could not share any ETA as of now. Once we get any update from engineering team, we will update you in this thread. Thanks!
DanielCutter commentedon Apr 2, 2025
@Prasad-MSFT I managed to resolve the issue when using ngrok. Not sure how to fix it for localhost but with the ngrok route I needed to replace
www.
withhttps://
in the manifest.json and that seemed to resolve the issue.I'm now facing a new problem but I'll raise that in a separate issue.
Genesys-AlexW commentedon Apr 10, 2025
We're running into a similar issue. Issue started around April 4, 2025.
5 remaining items