Forum Discussion
Problems with teams desktop calling Microsoft Teams JavaScript client SDK
zhy_qian - Could you please go through the following code sample and verify your code - Code sample
Hello, thank you very much for your reply. I refer to the sample code.
The authentication code is roughly the same.
Execute "microsoftTeams.initialize()" code first, and then execute "microsoftTeams.authentication.authenticate()" for authentication.
However, in my code, after the "microsoftTeams.initialize()" code is executed, debug the source code of "microsoftTeams.authentication.authenticate()". It is found that the value of "hostClientType" in the code does not exist.
If I can't call the internal browser of Teams desktop, it will affect my application.
Is there a solution?
- Meghana-MSFTDec 21, 2021Former Employee
zhy_qian - Please check the below code sample where we are getting hostClientType.
- zhy_qianDec 27, 2021Copper ContributorThank you very much.
I have found a solution to the problem that [hostclienttype] cannot be set before, but it has not solved my problem. The previous team client will open the page of the specified website through the browser, and the main page of the team client will directly call the [failurecallback] method that will be called back when the pop-up window is closed.
After the value of [hostclienttype] is set correctly, the team client does not pop up the pop-up page, and directly calls the [failurecallback] method that will be recalled when the pop-up window is closed, but the browser version of teams can pop up the pop-up window normally.
Is there any solution for the team client to call its internal browser pop-up window to pop up the page of the specified website.- Meghana-MSFTDec 28, 2021Former Employee
zhy_qian - Teams internal browser is a part of Microsoft Teams product. We do not have control over the internal browser to call/handle the events.
- zhy_qianDec 22, 2021Copper ContributorI have seen the sample provided. Thank you very much.
However, we have already known and tried the method of obtaining the value of hostclienttype in the sample code.
But the problem now is that the SDK source code runtime cannot get the value of hostClientType.
For example:
When we call the SDK with web Teams, we can get [hostClientType = "web"] through the foreground method [microsoftTeams.getContext()].
However, when debugging the beta SDK ("@microsoft/teams-js": "^2.0.0-beta.2"), it is found that [hostClientType = undefined] obtained in the authentication.authenticate method.
I want to know the reason for [hostClientType = undefined] in the source code on the premise that the foreground can obtain the value of hostclienttype?
How to solve it?